From: erickson Date: Thu, 24 Feb 2005 22:42:57 +0000 (+0000) Subject: cleaned some stuff out of the makefile X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=25fa139f997e1e70e0dd88d4cb3c14027fe8712d;p=opensrf%2Fbjwebb.git cleaned some stuff out of the makefile added milliseconds to log file output git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@115 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/libstack/Makefile b/src/libstack/Makefile index ff6e99c..92970a0 100644 --- a/src/libstack/Makefile +++ b/src/libstack/Makefile @@ -5,13 +5,14 @@ LIB_TARGETS = osrf_message.o osrf_app_session.o osrf_stack.o osrf_system.o EXE_LD_OPTS = -L $(LIB_DIR) -lxml2 -lopensrf_transport -lopensrf_stack -ljson CC = gcc -all: client sys_client +all: lib +#client sys_client -sys_client: sys_client.c lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o sys_client.c -o sys_client +#sys_client: sys_client.c lib +# $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o sys_client.c -o sys_client -client: client.c lib - $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o client.c -o client +#client: client.c lib +# $(CC) $(CC_OPTS) $(EXE_LD_OPTS) *.o client.c -o client # ---------------------------------------------------------------- diff --git a/src/libtransport/generic_utils.c b/src/libtransport/generic_utils.c index 6fb1722..cf67189 100644 --- a/src/libtransport/generic_utils.c +++ b/src/libtransport/generic_utils.c @@ -1,6 +1,7 @@ #include "opensrf/generic_utils.h" #include #include "pthread.h" +#include int _init_log(); @@ -11,11 +12,18 @@ int balance = 0; #define LOG_INFO 3 #define LOG_DEBUG 4 -void get_timestamp( char buf_25chars[]) { - time_t epoch = time(NULL); - char* localtime = strdup( ctime( &epoch ) ); - strcpy( buf_25chars, localtime ); - buf_25chars[ strlen(localtime)-1] = '\0'; // remove newline +void get_timestamp( char buf_36chars[]) { + + struct timeb tb; + ftime(&tb); + //time_t epoch = time(NULL); + char* localtime = strdup( ctime( &(tb.time) ) ); + char mil[4]; + memset(mil,0,4); + sprintf(mil," (%d)",tb.millitm); + strcpy( buf_36chars, localtime ); + buf_36chars[ strlen(localtime)-1] = '\0'; // remove newline + strcat(buf_36chars,mil); free(localtime); } @@ -41,8 +49,8 @@ void log_free() { if( log_file != NULL ) fclose(log_file ); } void fatal_handler( char* msg, ... ) { - char buf[25]; - memset( buf, 0, 25 ); + char buf[36]; + memset( buf, 0, 36 ); get_timestamp( buf ); pid_t pid = getpid(); va_list args; @@ -77,8 +85,8 @@ void fatal_handler( char* msg, ... ) { void warning_handler( char* msg, ... ) { - char buf[25]; - memset( buf, 0, 25 ); + char buf[36]; + memset( buf, 0, 36 ); get_timestamp( buf ); pid_t pid = getpid(); va_list args; @@ -112,8 +120,8 @@ void warning_handler( char* msg, ... ) { void info_handler( char* msg, ... ) { - char buf[25]; - memset( buf, 0, 25 ); + char buf[36]; + memset( buf, 0, 36 ); get_timestamp( buf ); pid_t pid = getpid(); va_list args; @@ -148,8 +156,8 @@ void info_handler( char* msg, ... ) { void debug_handler( char* msg, ... ) { - char buf[25]; - memset( buf, 0, 25 ); + char buf[36]; + memset( buf, 0, 36 ); get_timestamp( buf ); pid_t pid = getpid(); va_list args;