]> git.stg.codes - stg.git/blob - stglibs/common.lib/debug.c
Добавление исходников
[stg.git] / stglibs / common.lib / debug.c
1 /*
2  *****************************************************************************
3  *
4  * File:        debug.c
5  *
6  * Description: ÷Ù×ÏÄ ÏÔÌÁÄÏÞÎÏÊ ÉÎÆÏÒÍÁÃÉÉ × log ÆÁÊÌ
7  *
8  * $Id: debug.c,v 1.2 2005/11/16 16:19:40 nobunaga Exp $
9  *
10  *****************************************************************************
11  */
12
13 #include <stdarg.h>
14 #include <time.h>
15 #include <string.h>
16
17 #include "debug.h"
18
19
20 /*
21  *****************************************************************************
22  * -= óÏÚÄÁÎÉÅ ÚÁÐÉÓÉ × log-ÆÁÊÌÅ =-
23  *****************************************************************************
24  */
25 void PrintfLog(FILE * logFile, char * scriptName, char * fmt, ...)
26 {
27     #ifndef DEMO
28     va_list vaList;
29     char buff[MAX_LOG_BUFF_LEN];
30     time_t curTime;
31     char curTimeCh[26];
32
33     if (logFile)
34     {
35         va_start(vaList, fmt);
36         vsprintf(buff, fmt, vaList);
37         va_end(vaList);
38
39         curTime = time(NULL);
40         ctime_r(&curTime, curTimeCh);
41         curTimeCh[strlen(curTimeCh)-1] = 0;
42         fprintf(logFile, "%s [%s]: %s\n", scriptName, curTimeCh, buff);
43     }
44     #endif
45     return;
46 } /* PrintfLog() */
47
48 /* EOF */
49