Index: trunk/src/emx/src/lib/sys/logstrict.c
===================================================================
--- trunk/src/emx/src/lib/sys/logstrict.c	(revision 1315)
+++ trunk/src/emx/src/lib/sys/logstrict.c	(revision 1316)
@@ -21,6 +21,6 @@
 
 #define ISDIGIT(c) ((c) >= '0' && (c) <= '9')
-#define MAX(a, b)  ((a) >= (b) ? (a) : (b))
-#define MIN(a, b)  ((a) < (b) ? (a) : (b))
+//#define MAX(a, b)  ((a) >= (b) ? (a) : (b))
+//#define MIN(a, b)  ((a) < (b) ? (a) : (b))
 
 #define NTSF_CAPITAL    0x0001
@@ -48,4 +48,5 @@
 #include <setjmp.h>
 #include <machine/param.h>
+#include <InnoTekLIBC/thread.h>
 
 #define INCL_BASE
@@ -247,4 +248,17 @@
         DosWrite(pInst->hFile, psz, cch, &cb);
         DosWrite(pInst->hFile, "\n", 1, &cb);
+
+        cch = __libc_logSNPrintf(pszMsg, CCHTMPMSGBUFFER,
+                                 "\n"
+                                 "   Millsecond Timestamp.\n"
+                                 "   |     Thread ID.\n"
+                                 "   |     |  Call Nesting Level.\n"
+                                 "   |     |  |   Log Group.\n"
+                                 "   |     |  |   |    Message Type.\n"
+                                 "   |     |  |   |    |      Function Name.\n"
+                                 "   |     |  |   |    |      |        Millisconds In function (Optional).\n"
+                                 "   v     v  v   v    v      v        v\n"
+                                 "xxxxxxxx tt nn gggg dddd function [( ms)]: message\n");
+        DosWrite(pInst->hFile, pszMsg, cch, &cb);
     }
 
@@ -390,5 +404,5 @@
             { 1, "MUTEX" },             /* 13 */
             { 1, "SIGNAL" },            /* 14 */
-            { 1, "future" },            /* 15 */
+            { 1, "ENV" },               /* 15 */
             { 1, "future" },            /* 16 */
             { 1, "future" },            /* 17 */
@@ -581,4 +595,6 @@
     va_list         args;
     __LIBC_PLOGINST pInst;
+    unsigned       *pcDepth = NULL;
+    unsigned        cDepth;
 
     /*
@@ -587,7 +603,11 @@
     if (!pvInstance)
     {
+        __LIBC_PTHREAD  pThread;
         pvInstance = __libc_logDefault();
         if (!pvInstance)
             return uTS;
+        pThread = __libc_threadCurrentNoAuto();
+        if (pThread)
+            pcDepth = &pThread->cDefLoggerDepth;
     }
     pInst = (__LIBC_PLOGINST)pvInstance;
@@ -606,4 +626,12 @@
 
     /*
+     * Nesting depth.
+     */
+    if (pcDepth)
+        cDepth = ++*pcDepth;
+    else
+        cDepth = 0xff;
+
+    /*
      * Allocate logging buffer and format the message.
      */
@@ -613,6 +641,6 @@
 
     va_start(args, pszFormat);
-    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Entr %s: ",
-                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Entr %s: ",
+                             uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     va_end(args);
 
@@ -645,4 +673,6 @@
     va_list         args;
     __LIBC_PLOGINST pInst;
+    unsigned       *pcDepth = NULL;
+    unsigned        cDepth;
 
     /*
@@ -651,7 +681,11 @@
     if (!pvInstance)
     {
+        __LIBC_PTHREAD pThread;
         pvInstance = __libc_logDefault();
         if (!pvInstance)
             return;
+        pThread = __libc_threadCurrentNoAuto();
+        if (pThread)
+            pcDepth = &pThread->cDefLoggerDepth;
     }
     pInst = (__LIBC_PLOGINST)pvInstance;
@@ -670,4 +704,17 @@
 
     /*
+     * Nesting depth.
+     */
+    if (pcDepth)
+    {
+        if (*pcDepth)
+            cDepth = --*pcDepth;
+        else
+            cDepth = 0xfe;
+    }
+    else
+        cDepth = 0xff;
+
+    /*
      * Allocate logging buffer and format the message.
      */
@@ -677,6 +724,6 @@
 
     va_start(args, pszFormat);
-    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Leav %s (%2d ms): ",
-                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Leav %s (%2d ms): ",
+                             uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
     va_end(args);
 
@@ -708,4 +755,5 @@
     va_list         args;
     __LIBC_PLOGINST pInst;
+    unsigned        cDepth = 0xff;
 
     /*
@@ -714,7 +762,11 @@
     if (!pvInstance)
     {
+        __LIBC_PTHREAD pThread;
         pvInstance = __libc_logDefault();
         if (!pvInstance)
             return;
+        pThread = __libc_threadCurrentNoAuto();
+        if (pThread)
+            cDepth = pThread->cDefLoggerDepth;
     }
     pInst = (__LIBC_PLOGINST)pvInstance;
@@ -741,9 +793,9 @@
     va_start(args, pszFormat);
     if (uEnterTS != ~0)
-        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s (%2d ms): ",
-                                 uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
+        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Mesg %s (%2d ms): ",
+                                 uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction, uTS - uEnterTS);
     else
-        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Mesg %s: ",
-                                 uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+        cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Mesg %s: ",
+                                 uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     va_end(args);
 
@@ -831,4 +883,5 @@
     va_list         args;
     __LIBC_PLOGINST pInst;
+    unsigned        cDepth = 0xff;
     FS_VAR();
 
@@ -848,7 +901,11 @@
     if (!pvInstance)
     {
+        __LIBC_PTHREAD pThread;
         pvInstance = __libc_logDefault();
         if (!pvInstance)
             return;
+        pThread = __libc_threadCurrentNoAuto();
+        if (pThread)
+            cDepth = pThread->cDefLoggerDepth;
     }
     pInst = (__LIBC_PLOGINST)pvInstance;
@@ -881,31 +938,30 @@
     FS_SAVE_LOAD();
     va_start(args, pszFormat);          /* make compiler happy we do it here. */
-    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Assertion Failed!!!\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Assertion Failed!!!\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags));
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
         DosWrite(2, pszMsg, cch, &cb);
 
-    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Function: %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Function: %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFunction);
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
         DosWrite(2, pszMsg, cch, &cb);
 
-    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: File:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFile);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: File:     %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszFile);
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
         DosWrite(2, pszMsg, cch, &cb);
 
-    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Line:     %d\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), uLine);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Line:     %d\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), uLine);
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
         DosWrite(2, pszMsg, cch, &cb);
 
-    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %04x Asrt: Expr:     %s\n", uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags), pszExpression);
+    cch = __libc_logBuildMsg(pszMsg, "", args, "%08x %02x %02x %04x Asrt: Expr:     %s\n", uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags), pszExpression);
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
         DosWrite(2, pszMsg, cch, &cb);
 
-    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %04x Asrt: ",
-                             uTS, getTid(), __LIBC_LOG_GETGROUP(fGroupAndFlags));
+    cch = __libc_logBuildMsg(pszMsg, pszFormat, args, "%08x %02x %02x %04x Asrt: ",        uTS, getTid(), cDepth, __LIBC_LOG_GETGROUP(fGroupAndFlags));
     __libc_logWrite(pInst, fGroupAndFlags, pszMsg, cch);
     if (fEnabled)
Index: trunk/src/emx/src/lib/sys/syscalls.h
===================================================================
--- trunk/src/emx/src/lib/sys/syscalls.h	(revision 1315)
+++ trunk/src/emx/src/lib/sys/syscalls.h	(revision 1316)
@@ -9,6 +9,6 @@
 #ifndef __LIBC_THREAD_DECLARED
 #define __LIBC_THREAD_DECLARED
-struct __libc_threadCurrentSlow;
-typedef struct __libc_threadCurrentSlow *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
+struct __libc_thread;
+typedef struct __libc_thread *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
 #endif
 
