-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.c
54 lines (41 loc) · 885 Bytes
/
log.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- C -*- */
#include "log.h"
static int
log_vflogf(FILE *fd, int level, const char *format, va_list args)
{
int retval = 0;
if (VERBOSE >= level) {
retval = vfprintf(fd, format, args);
}
return retval;
}
int
log_logf(int level, const char *format, ...)
{
int retval = 0;
va_list args;
va_start(args, format);
retval = log_vflogf(stdout, level, format, args);
va_end(args);
return retval;
}
int
log_errlogf(int level, const char *format, ...)
{
int retval = 0;
va_list args;
va_start(args, format);
retval = log_vflogf(stderr, level, format, args);
va_end(args);
return retval;
}
int
log_flogf(FILE* fd, int level, const char *format, ...)
{
int retval = 0;
va_list args;
va_start(args, format);
retval = log_vflogf(fd, level, format, args);
va_end(args);
return retval;
}