Ooops, LOG_TRACE should be LOG_DEBUG
[nobug.git] / nobug.c
blob4787add677b9d3b7593bc6019007c3a1f7cacf7c
1 /*
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.
20 #define NOBUG_LIBNOBUG_C
21 #include "nobug.h"
23 struct nobug_ringbuffer* nobug_default_ringbuffer = NULL;
24 static struct nobug_ringbuffer nobug_default_ringbuffer_real;
25 FILE* nobug_default_file = NULL;
27 struct nobug_flag nobug_flag_NOBUG_ON =
28 {NULL, {LOG_DEBUG, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG, LOG_DEBUG}, NULL,NULL,NULL};
30 static int nobug_initialized = 0;
33 default initialization
35 void
36 nobug_init()
38 if (nobug_initialized)
39 return;
41 nobug_initialized = 1;
43 /* we initialize a minimal ringbuffer */
44 if (!nobug_default_ringbuffer)
46 nobug_default_ringbuffer = &nobug_default_ringbuffer_real;
47 nobug_ringbuffer_init (nobug_default_ringbuffer, 4096, NULL, NOBUG_RINGBUFFER_DEFAULT);
50 /* initialize the always-on flag*/
51 nobug_flag_NOBUG_ON.ringbuffer_target = nobug_default_ringbuffer;
52 nobug_flag_NOBUG_ON.console_target = stderr;
53 nobug_flag_NOBUG_ON.file_target = nobug_default_file;