Changeset 959 for trunk/client/src/debug.c
- Timestamp:
- Aug 16, 2016, 5:35:07 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/src/debug.c
r957 r959 43 43 int debuglvl(int level) 44 44 { 45 45 return (level <= debuglevel) ? 1 : 0; 46 46 } 47 47 … … 79 79 } 80 80 else 81 {82 81 strncat(logfile, logfilename, sizeof(logfile) -1); 83 }82 84 83 // set the samba logging stuff 85 84 do_logging = TRUE; … … 88 87 rc = DosCreateMutexSem(nameMutex, &logMutex, 0, FALSE); 89 88 if (rc == ERROR_DUPLICATE_NAME) 90 { 91 rc = DosOpenMutexSem(nameMutex, &logMutex); 92 } 89 rc = DosOpenMutexSem(nameMutex, &logMutex); 93 90 94 91 return; … … 107 104 // do we have to log at all 108 105 if (!do_logging) 109 { 110 return; 111 } 106 return; 112 107 113 108 // if the sem is created we request it 114 109 if (logMutex) 115 {116 110 DosRequestMutexSem(logMutex, (ULONG) SEM_INDEFINITE_WAIT); 117 }118 111 119 do 120 { 121 struct timeval tv; 122 char buf[80] = {0}; 123 va_list args; 124 if (logfile[0]) 125 { 126 f = fopen(logfile, "a"); 127 if (!f) 128 { 129 break; 130 } 131 } 132 else 133 { 134 f = stdout; 135 } 112 do { 113 struct timeval tv; 114 char buf[80] = {0}; 115 va_list args; 116 if (logfile[0]) 117 { 118 f = fopen(logfile, "a"); 119 if (!f) 120 break; 121 } 122 else 123 f = stdout; 136 124 137 138 139 140 141 142 143 125 // in the first log line we write our version of the client 126 if (firstLogLine) 127 { 128 fprintf(f, "Samba client %s build %s based on %s\n", VERSION, BUILD, smbwrp_getVersion()); 129 fprintf(f, "This build is maintained by %s\n", VENDOR); 130 firstLogLine = FALSE; 131 } 144 132 145 gettimeofday(&tv, NULL); 146 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec)); 147 fprintf(f, "%s.%d: %d %d: ", buf, tv.tv_usec / 10000, level, (long)_gettid()); 148 va_start(args, fmt); 149 vfprintf(f, fmt, args); 150 va_end(args); 151 if (logfile) 152 { 153 // fflush(f); 154 fclose(f); 155 } 156 } 157 while (0); 133 gettimeofday(&tv, NULL); 134 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec)); 135 fprintf(f, "%s.%d: %d %d: ", buf, tv.tv_usec / 10000, level, (long)_gettid()); 136 va_start(args, fmt); 137 vfprintf(f, fmt, args); 138 va_end(args); 139 if (logfile) 140 fclose(f); 141 142 } while (0); 158 143 159 144 // if the sem is created we release it 160 145 if (logMutex) 161 {162 146 DosReleaseMutexSem(logMutex); 163 }164 147 165 148 return;
Note:
See TracChangeset
for help on using the changeset viewer.