00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025 #include <time.h>
00026 #include <ctype.h>
00027 #include <math.h>
00028 #include <assert.h>
00029 #include <errno.h>
00030 #include <unistd.h>
00031 #include <string.h>
00032 #include <sys/types.h>
00033 #include <sys/stat.h>
00034 #include <fcntl.h>
00035 #include <stdarg.h>
00036 #include <dirent.h>
00037
00038 #include "common.h"
00039
00040 FILE *logFile=NULL;
00041
00044 void LogPrint(const char *format, ...)
00045 {
00046 va_list ap;
00047 if ((!logInfo)||(currentTime.usecond<=0))
00048 {
00049 return;
00050 }
00051 if (logFile==NULL)
00052 {
00053 logFile=stdout;
00054 }
00055 if (logFile!=NULL)
00056 {
00057 fprintf(logFile,"%s %d %s:%s ",
00058 StrTimeNS(¤tTime),
00059 (int32_t)(currentTime.usecond>>32),
00060 HWConfig.fieldIdent,
00061 HWConfig.serialNumber);
00062 va_start(ap,format);
00063 vfprintf(logFile,format,ap);
00064 va_end(ap);
00065 }
00066 }