-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.c
executable file
·41 lines (35 loc) · 992 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
/*
** log.c
**
** Simple printf wrapper so that verbose output ("logging") to the console can be
** enabled by the --verbose option, but suppressed completely when piping output
** to another application.
*/
#include <stdarg.h>
#include "wavgen.h"
/*
** Standard log (printf) output, sent to the console if file output is chosen.
*/
__attribute__((__format__ (__printf__, 2, 0)))
void log_info(struct FIXED_PARAMS *fixed, const char *format, ...)
{
va_list args;
va_start(args, format);
if (!fixed->piping) {
vprintf(format, args);
}
va_end(args);
}
/*
** Extra log output, only sent to the console if file output is chosen AND "verbose" is selected.
*/
__attribute__((__format__ (__printf__, 2, 0)))
void log_extra(struct FIXED_PARAMS *fixed, const char *format, ...)
{
va_list args;
va_start(args, format);
if (fixed->verbose & !fixed->piping) {
vprintf(format, args);
}
va_end(args);
}