在Foxpro中如何获取调用堆栈信息以进行日志记录

发布于 2024-09-17 11:54:28 字数 53 浏览 10 评论 0原文

在Foxpro中如何获取调用堆栈信息进行日志记录。(不使用调试器ui,而是在运行时的代码中)

In Foxpro how to get Call stack info for logging.(not using the debugger ui, but in code at runtime)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

楠木可依 2024-09-24 11:54:28

您可以使用 ASTACKINFO() 函数创建一个填充调用堆栈的数组。

You can use the ASTACKINFO() function to create an array filled with the call stack.

回忆躺在深渊里 2024-09-24 11:54:28

使用 ASTACKINFO 就像 MikeReigler 所说,然后类似这:

    cStack = ""
    nStackCount = astackinfo(arrStackInfo)

    for nCount = nStackCount to 1 step -1

        cStack = cStack + "Level " + transform(arrStackInfo(nCount, 1)) + chr(13)
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 2)), ;
            "Filename: " + transform(arrStackInfo(nCount, 2)) + chr(13) , "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 3)), ;
            "Module/Object name: " + transform(arrStackInfo(nCount, 3)) + chr(13) , "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 4)), ;
            "Module/Object filename: " + transform(arrStackInfo(nCount, 4)) + chr(13), "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 5)), ;
            "Line # : " + transform(arrStackInfo(nCount, 5), "999999") + chr(13), "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 6)), ;
            "Code: " + transform(arrStackInfo(nCount, 6)) + chr(13), "")
        cStack = cStack + chr(13)

    next

use ASTACKINFO like MikeReigler said, then something like this:

    cStack = ""
    nStackCount = astackinfo(arrStackInfo)

    for nCount = nStackCount to 1 step -1

        cStack = cStack + "Level " + transform(arrStackInfo(nCount, 1)) + chr(13)
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 2)), ;
            "Filename: " + transform(arrStackInfo(nCount, 2)) + chr(13) , "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 3)), ;
            "Module/Object name: " + transform(arrStackInfo(nCount, 3)) + chr(13) , "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 4)), ;
            "Module/Object filename: " + transform(arrStackInfo(nCount, 4)) + chr(13), "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 5)), ;
            "Line # : " + transform(arrStackInfo(nCount, 5), "999999") + chr(13), "")
        cStack = cStack + iif(not empty(arrStackInfo(nCount, 6)), ;
            "Code: " + transform(arrStackInfo(nCount, 6)) + chr(13), "")
        cStack = cStack + chr(13)

    next
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文