Changeset 1316


Ignore:
Timestamp:
Mar 17, 2004, 5:00:43 AM (21 years ago)
Author:
bird
Message:

More and better logging.

Location:
trunk/src/emx/src/lib/sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/logstrict.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1315 r1316  
    2121
    2222#define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
    23 #define MAX(a, b)  ((a) >= (b) ? (a) : (b))
    24 #define MIN(a, b)  ((a) < (b) ? (a) : (b))
     23//#define MAX(a, b)  ((a) >= (b) ? (a) : (b))
     24//#define MIN(a, b)  ((a) < (b) ? (a) : (b))
    2525
    2626#define NTSF_CAPITAL    0x0001
     
    4848#include <setjmp.h>
    4949#include <machine/param.h>
     50#include <InnoTekLIBC/thread.h>
    5051
    5152#define INCL_BASE
     
    247248        DosWrite(pInst->hFile, psz, cch, &cb);
    248249        DosWrite(pInst->hFile, "\n", 1, &cb);
     250
     251        cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER,
     252                                 "\n"
     253                                 "   Millsecond Timestamp.\n"
     254                                 "   |     Thread ID.\n"
     255                                 "   |     |  Call Nesting Level.\n"
     256                                 "   |     |  |   Log Group.\n"
     257                                 "   |     |  |   |    Message Type.\n"
     258                                 "   |     |  |   |    |      Function Name.\n"
     259                                 "   |     |  |   |    |      |        Millisconds In function (Optional).\n"
     260                                 "   v     v  v   v    v      v        v\n"
     261                                 "xxxxxxxx tt nn gggg dddd function [( ms)]: message\n");
     262        DosWrite(pInst->hFile, pszMsg, cch, &cb);
    249263    }
    250264
     
    390404            { 1, "MUTEX" },             /* 13 */
    391405            { 1, "SIGNAL" },            /* 14 */
    392             { 1, "future" },            /* 15 */
     406            { 1, "ENV" },               /* 15 */
    393407            { 1, "future" },            /* 16 */
    394408            { 1, "future" },            /* 17 */
     
    581595    va_list         args;
    582596    __LIBC_PLOGINST pInst;
     597    unsigned       *pcDepth = NULL;
     598    unsigned        cDepth;
    583599
    584600    /*
     
    587603    if (!pvInstance)
    588604    {
     605        __LIBC_PTHREAD  pThread;
    589606        pvInstance = __libc_logDefault();
    590607        if (!pvInstance)
    591608            return uTS;
     609        pThread = __libc_threadCurrentNoAuto();
     610        if (pThread)
     611            pcDepth = &pThread->cDefLoggerDepth;
    592612    }
    593613    pInst = (__LIBC_PLOGINST)pvInstance;
     
    606626
    607627    /*
     628     * Nesting depth.
     629     */
     630    if (pcDepth)
     631        cDepth = ++*pcDepth;
     632    else
     633        cDepth = 0xff;
     634
     635    /*
    608636     * Allocate logging buffer and format the message.
    609637     */
     
    613641
    614642    va_start(args, pszFormat);
    615     cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Entr %s: ",
    616                              uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     643    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Entr %s: ",
     644                             uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
    617645    va_end(args);
    618646
     
    645673    va_list         args;
    646674    __LIBC_PLOGINST pInst;
     675    unsigned       *pcDepth = NULL;
     676    unsigned        cDepth;
    647677
    648678    /*
     
    651681    if (!pvInstance)
    652682    {
     683        __LIBC_PTHREAD pThread;
    653684        pvInstance = __libc_logDefault();
    654685        if (!pvInstance)
    655686            return;
     687        pThread = __libc_threadCurrentNoAuto();
     688        if (pThread)
     689            pcDepth = &pThread->cDefLoggerDepth;
    656690    }
    657691    pInst = (__LIBC_PLOGINST)pvInstance;
     
    670704
    671705    /*
     706     * Nesting depth.
     707     */
     708    if (pcDepth)
     709    {
     710        if (*pcDepth)
     711            cDepth = --*pcDepth;
     712        else
     713            cDepth = 0xfe;
     714    }
     715    else
     716        cDepth = 0xff;
     717
     718    /*
    672719     * Allocate logging buffer and format the message.
    673720     */
     
    677724
    678725    va_start(args, pszFormat);
    679     cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Leav %s (%2d ms): ",
    680                              uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
     726    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Leav %s (%2d ms): ",
     727                             uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
    681728    va_end(args);
    682729
     
    708755    va_list         args;
    709756    __LIBC_PLOGINST pInst;
     757    unsigned        cDepth = 0xff;
    710758
    711759    /*
     
    714762    if (!pvInstance)
    715763    {
     764        __LIBC_PTHREAD pThread;
    716765        pvInstance = __libc_logDefault();
    717766        if (!pvInstance)
    718767            return;
     768        pThread = __libc_threadCurrentNoAuto();
     769        if (pThread)
     770            cDepth = pThread->cDefLoggerDepth;
    719771    }
    720772    pInst = (__LIBC_PLOGINST)pvInstance;
     
    741793    va_start(args, pszFormat);
    742794    if (uEnterTS != ~0)
    743         cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s (%2d ms): ",
    744                                  uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
     795        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Mesg %s (%2d ms): ",
     796                                 uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
    745797    else
    746         cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s: ",
    747                                  uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     798        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Mesg %s: ",
     799                                 uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
    748800    va_end(args);
    749801
     
    831883    va_list         args;
    832884    __LIBC_PLOGINST pInst;
     885    unsigned        cDepth = 0xff;
    833886    FS_VAR();
    834887
     
    848901    if (!pvInstance)
    849902    {
     903        __LIBC_PTHREAD pThread;
    850904        pvInstance = __libc_logDefault();
    851905        if (!pvInstance)
    852906            return;
     907        pThread = __libc_threadCurrentNoAuto();
     908        if (pThread)
     909            cDepth = pThread->cDefLoggerDepth;
    853910    }
    854911    pInst = (__LIBC_PLOGINST)pvInstance;
     
    881938    FS_SAVE_LOAD();
    882939    va_start(args, pszFormat);          /* make compiler happy we do it here. */
    883     cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Assertion Failed!!!\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
     940    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Assertion Failed!!!\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags));
    884941    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    885942    if (fEnabled)
    886943        DosWrite(2, pszMsg, cch, &cb);
    887944
    888     cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Function: %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     945    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Function: %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
    889946    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    890947    if (fEnabled)
    891948        DosWrite(2, pszMsg, cch, &cb);
    892949
    893     cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: File:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFile);
     950    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: File:     %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFile);
    894951    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    895952    if (fEnabled)
    896953        DosWrite(2, pszMsg, cch, &cb);
    897954
    898     cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Line:     %d\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), uLine);
     955    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Line:     %d\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), uLine);
    899956    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    900957    if (fEnabled)
    901958        DosWrite(2, pszMsg, cch, &cb);
    902959
    903     cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Expr:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszExpression);
     960    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Expr:     %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszExpression);
    904961    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    905962    if (fEnabled)
    906963        DosWrite(2, pszMsg, cch, &cb);
    907964
    908     cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Asrt: ",
    909                              uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
     965    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Asrt: ",        uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags));
    910966    __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
    911967    if (fEnabled)
  • trunk/src/emx/src/lib/sys/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.9 to 1.10
    r1315 r1316  
    99#ifndef __LIBC_THREAD_DECLARED
    1010#define __LIBC_THREAD_DECLARED
    11 struct __libc_threadCurrentSlow;
    12 typedef struct __libc_threadCurrentSlow *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
     11struct __libc_thread;
     12typedef struct __libc_thread *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
    1313#endif
    1414
Note: See TracChangeset for help on using the changeset viewer.