From ea8f4961c6e4f94bf82e4c4cadbab4ec08824ae4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 22 Feb 2015 22:03:39 +0100 Subject: [SERVER] Overhauled logging - Added message type parameter - Log to file and stdout, no more logging in memory - Added options to server.conf to filter which messages show up where --- src/server/locks.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/server/locks.h') diff --git a/src/server/locks.h b/src/server/locks.h index efd0a37..27af006 100644 --- a/src/server/locks.h +++ b/src/server/locks.h @@ -37,7 +37,7 @@ void debug_dump_lock_stats(); #ifdef DEBUG_THREADS extern int debugThreadCount; -#define thread_create(thread,attr,routine,arg) (printf("[THREAD CREATE] %d @ %s:%d\n", debugThreadCount, __FILE__, (int)__LINE__), debug_thread_create(thread, attr, routine, arg)) +#define thread_create(thread,attr,routine,arg) (logadd( LOG_THREAD CREATE, "%d @ %s:%d\n", debugThreadCount, __FILE__, (int)__LINE__), debug_thread_create(thread, attr, routine, arg)) static inline pthread_t debug_thread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) { int i; @@ -47,26 +47,26 @@ static inline pthread_t debug_thread_create(pthread_t *thread, const pthread_att return pthread_create( thread, attr, start_routine, arg ); } -#define thread_detach(thread) (printf("[THREAD DETACH] %d @ %s:%d\n", debugThreadCount, __FILE__, __LINE__), debug_thread_detach(thread)) +#define thread_detach(thread) (logadd( LOG_THREAD DETACH, "%d @ %s:%d\n", debugThreadCount, __FILE__, __LINE__), debug_thread_detach(thread)) static inline int debug_thread_detach(pthread_t thread) { const int ret = pthread_detach(thread); if (ret == 0) { --debugThreadCount; } else { - printf("[THREAD DETACH] Tried to detach invalid thread (error %d)\n", (int)errno); + logadd( LOG_THREAD DETACH, "Tried to detach invalid thread (error %d)\n", (int)errno); exit(1); } return ret; } -#define thread_join(thread,value) (printf("[THREAD JOIN] %d @ %s:%d\n", debugThreadCount, __FILE__, __LINE__), debug_thread_join(thread,value)) +#define thread_join(thread,value) (logadd( LOG_THREAD JOIN, "%d @ %s:%d\n", debugThreadCount, __FILE__, __LINE__), debug_thread_join(thread,value)) static inline int debug_thread_join(pthread_t thread, void **value_ptr) { const int ret = pthread_join(thread, value_ptr); if (ret == 0) { --debugThreadCount; } else { - printf("[THREAD JOIN] Tried to join invalid thread (error %d)\n", (int)errno); + logadd( LOG_THREAD JOIN, "Tried to join invalid thread (error %d)\n", (int)errno); exit(1); } return ret; -- cgit v1.2.3-55-g7522