gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-support/png2hicolorgb/src/logging.c
1 // logging.c
2
3 #include <stdarg.h>
4 #include <stdio.h>
5
6 #include "logging.h"
7
8 static enum output_level output_level = OUTPUT_LEVEL_DEFAULT;
9
10
11 #define VA_LIST_PRINT() \
12 va_list args; \
13 va_start (args, format); \
14 vprintf (format, args); \
15 va_end (args); \
16 fflush(stdout); // If logging a lot of output to a file turn off the excessive flushing
17
18
19 void set_log_level(enum output_level new_output_level) {
20 output_level = new_output_level;
21 }
22
23 int log_(enum output_level level, const char *fmt, ...) {
24 if (output_level > level) {
25 return 0; // Pretend everything went smoothly. (It did, kind of!)
26 }
27
28 va_list ap;
29 va_start(ap, fmt);
30 int ret = vfprintf(stderr, fmt, ap);
31 va_end(ap);
32 return ret;
33 }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.