log: make more logging options configurable

* Add --log-colorize=never|always|auto
* Add --log-no-syslog
This commit is contained in:
Daniel Eklöf 2020-02-05 19:42:48 +01:00
parent 3f940ec2a8
commit 7397ab9457
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 74 additions and 19 deletions

6
log.h
View file

@ -1,7 +1,13 @@
#pragma once
#include <stdbool.h>
enum log_colorize { LOG_COLORIZE_NEVER, LOG_COLORIZE_ALWAYS, LOG_COLORIZE_AUTO };
enum log_class { LOG_CLASS_ERROR, LOG_CLASS_WARNING, LOG_CLASS_INFO, LOG_CLASS_DEBUG };
void log_init(enum log_colorize colorize, bool do_syslog);
void log_deinit(void);
void log_msg(enum log_class log_class, const char *module,
const char *file, int lineno,
const char *fmt, ...) __attribute__((format (printf, 5, 6)));