2 nobug.c - a small debugging library
4 Copyright (C) 2007, Christian Thaeter <ct@pipapo.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
22 #define NOBUG_LIBNOBUG_C
25 struct nobug_ringbuffer nobug_default_ringbuffer
;
26 FILE* nobug_default_file
= NULL
;
28 struct nobug_flag nobug_flag_NOBUG_ON
=
29 {NULL
, {LOG_DEBUG
, LOG_DEBUG
, LOG_DEBUG
, LOG_DEBUG
, LOG_DEBUG
}, NULL
,NULL
,NULL
};
31 static int nobug_initialized
= 0;
35 default initialization
40 if (nobug_initialized
)
43 nobug_initialized
= 1;
46 pthread_key_create (&nobug_thread_id_key
, free
);
49 /* we initialize a minimal ringbuffer, if not already done */
50 if (!nobug_default_ringbuffer
.start
)
51 nobug_ringbuffer_init (&nobug_default_ringbuffer
, 4096, NULL
, NOBUG_RINGBUFFER_DEFAULT
);
53 /* initialize the always-on flag*/
54 nobug_flag_NOBUG_ON
.ringbuffer_target
= &nobug_default_ringbuffer
;
55 nobug_flag_NOBUG_ON
.console_target
= stderr
;
56 nobug_flag_NOBUG_ON
.file_target
= nobug_default_file
;