source: trunk/samba/source/ndpsmb/h/mydebug.h@ 46

Last change on this file since 46 was 46, checked in by Paul Smedley, 18 years ago

Fixes ticket #21

  • Property svn:eol-style set to native
File size: 656 bytes
Line 
1#ifndef _MY_DEBUG_
2#define _MY_DEBUG_ 1
3
4#ifdef DEBUG
5
6#include <stdio.h>
7#include <stdlib.h>
8#include <stdarg.h>
9#include <time.h>
10
11void log(const char *fmt, ...)
12{
13 FILE * logfile = NULL;
14 va_list args;
15 time_t t = time(NULL);
16 char timebuf[80] = {0};
17 strftime(timebuf,sizeof(timebuf)-1,"%Y/%m/%d %H:%M:%S", localtime(&t));
18 logfile = fopen("e:\\smblog","a");
19 if (logfile == NULL)
20 {
21#if 0
22 DosBeep(400,400);
23#endif
24 }
25 else
26 {
27 fprintf(logfile, "%s: (%02d) ", timebuf, _gettid());
28 va_start(args, fmt);
29 vfprintf(logfile, fmt, args);
30 va_end(args);
31 fclose(logfile);
32 }
33}
34
35#else
36
37#define log( ... ) { 1; }
38
39#endif
40
41#endif /* _MY_DEBUG_ */
Note: See TracBrowser for help on using the repository browser.