summaryrefslogtreecommitdiffstats
path: root/src/server/locks.h
diff options
context:
space:
mode:
authorSimon Rettberg2015-02-22 22:03:39 +0100
committerSimon Rettberg2015-02-22 22:03:39 +0100
commitea8f4961c6e4f94bf82e4c4cadbab4ec08824ae4 (patch)
tree4371eacef27e477523d6e05ef29c741540a77e32 /src/server/locks.h
parentGet rid of unneccessary volatile (diff)
downloaddnbd3-ea8f4961c6e4f94bf82e4c4cadbab4ec08824ae4.tar.gz
dnbd3-ea8f4961c6e4f94bf82e4c4cadbab4ec08824ae4.tar.xz
dnbd3-ea8f4961c6e4f94bf82e4c4cadbab4ec08824ae4.zip
[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
Diffstat (limited to 'src/server/locks.h')
-rw-r--r--src/server/locks.h10
1 files changed, 5 insertions, 5 deletions
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;