compile mode where no logging is produced

This commit is contained in:
folkert van heusden 2023-03-27 09:35:36 +02:00
parent 2563bbac57
commit 00b4214ea0
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 10 additions and 0 deletions

4
config.h Normal file
View file

@ -0,0 +1,4 @@
// (C) 2018-2023 by Folkert van Heusden
// Released under MIT license
#define TURBO

6
log.h
View file

@ -5,6 +5,8 @@
#include <string>
#include "config.h"
typedef enum { debug, info, warning, ll_error, none } log_level_t; // TODO ll_ prefix
@ -14,9 +16,13 @@ void setloguid(const int uid, const int gid);
void closelog();
void dolog(const log_level_t ll, const char *fmt, ...);
#ifdef TURBO
#define DOLOG(ll, always, fmt, ...) do { } while(0)
#else
#define DOLOG(ll, always, fmt, ...) do { \
extern log_level_t log_level_file, log_level_screen; \
\
if (always || ll >= log_level_file || ll >= log_level_screen) \
dolog(ll, fmt, ##__VA_ARGS__); \
} while(0)
#endif