girara
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
debug.c
Go to the documentation of this file.
1
/* See LICENSE file for license and copyright information */
2
3
#include "
utils.h
"
4
#include <stdarg.h>
5
6
static
girara_debug_level_t
debug_level =
GIRARA_DEBUG
;
7
8
void
9
_girara_debug
(
const
char
*
function
,
int
line,
girara_debug_level_t
level,
const
char
* format, ...)
10
{
11
if
(level < debug_level) {
12
return
;
13
}
14
15
switch
(level)
16
{
17
case
GIRARA_WARNING
:
18
fprintf(stderr,
"warning: "
);
19
break
;
20
case
GIRARA_ERROR
:
21
fprintf(stderr,
"error: "
);
22
break
;
23
case
GIRARA_INFO
:
24
fprintf(stderr,
"info: "
);
25
break
;
26
case
GIRARA_DEBUG
:
27
fprintf(stderr,
"debug: (%s:%d) "
,
function
, line);
28
break
;
29
default
:
30
return
;
31
}
32
33
va_list ap;
34
va_start(ap, format);
35
vfprintf(stderr, format, ap);
36
va_end(ap);
37
38
fprintf(stderr,
"\n"
);
39
}
40
41
girara_debug_level_t
42
girara_get_debug_level
()
43
{
44
return
debug_level;
45
}
46
47
void
48
girara_set_debug_level
(
girara_debug_level_t
level)
49
{
50
debug_level = level;
51
}
girara_debug_level_t
girara_debug_level_t
Definition:
types.h:58
girara_get_debug_level
girara_debug_level_t girara_get_debug_level()
Definition:
debug.c:42
utils.h
GIRARA_ERROR
Definition:
types.h:63
girara_set_debug_level
void girara_set_debug_level(girara_debug_level_t level)
Definition:
debug.c:48
GIRARA_DEBUG
Definition:
types.h:60
_girara_debug
void _girara_debug(const char *function, int line, girara_debug_level_t level, const char *format,...)
Definition:
debug.c:9
GIRARA_INFO
Definition:
types.h:61
GIRARA_WARNING
Definition:
types.h:62
Generated on Sat Jul 26 2014 17:12:22 for girara by
1.8.7