diff options
author | 2019-05-13 15:30:51 +0300 | |
---|---|---|
committer | 2019-05-13 15:30:51 +0300 | |
commit | 76c83e9d13295089919ce09af01a7e7149777b19 (patch) | |
tree | 9edab51e2a0ea6c6b36c05b3d16c72404aae32b2 | |
parent | 7162265c0480bf5bfc6187b28c58b0f6f5db42e1 (diff) | |
parent | 4edfc4c937b4336bcfa7ef4b41cc3e97b24b13f1 (diff) | |
download | usurpation-76c83e9d13295089919ce09af01a7e7149777b19.tar.gz usurpation-76c83e9d13295089919ce09af01a7e7149777b19.tar.bz2 usurpation-76c83e9d13295089919ce09af01a7e7149777b19.zip |
Merge branch '29-verbosity-levels'.
-rw-r--r-- | meson.build | 8 | ||||
-rw-r--r-- | src/daemon/settings.c | 4 | ||||
-rw-r--r-- | src/daemon/settings_private.h | 6 |
3 files changed, 14 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 44e004e..4a780c8 100644 --- a/meson.build +++ b/meson.build @@ -15,8 +15,14 @@ add_project_arguments('-D', resource_dir_arg, language : 'c') add_project_link_arguments('-rdynamic', language : 'c') subdir('src') +verb = '1' +if get_option('buildtype') == 'debug' + verb = '3' +elif get_option('buildtype') == 'debugoptimized' + verb = '3' +endif -daemon = executable(progname, d_sources, version, include_directories : inc, install : true, dependencies : deps, extra_files : d_conf) +daemon = executable(progname, d_sources, version, include_directories : inc, install : true, dependencies : deps, extra_files : d_conf, c_args : '-DUSURP_VERBOSITY=' + verb) #install_data(extra, install_dir : resource_dir) install_data(d_conf, install_dir : get_option('sysconfdir')) diff --git a/src/daemon/settings.c b/src/daemon/settings.c index 8decf08..bac1c3b 100644 --- a/src/daemon/settings.c +++ b/src/daemon/settings.c @@ -30,7 +30,7 @@ void settings_init(void) { unset_flag(flag_daemonize); settings.port = 6996; - set_flag(flag_verbose); + settings.verbosity = USURP_VERBOSITY; } int setting_detach(void) @@ -40,7 +40,7 @@ int setting_detach(void) int setting_verbose(void) { - return test_flag(flag_verbose); + return settings.verbosity; } unsigned short int setting_port(void) diff --git a/src/daemon/settings_private.h b/src/daemon/settings_private.h index 336c151..7839cb9 100644 --- a/src/daemon/settings_private.h +++ b/src/daemon/settings_private.h @@ -22,12 +22,16 @@ #ifndef USURPATION_SETTINGS_PRIVATE_H #define USURPATION_SETTINGS_PRIVATE_H +#ifndef USURP_VERBOSITY + #define USURP_VERBOSITY 1 +#endif + static const unsigned int flag_daemonize = 1 << 0; /* 1st bit */ -static const unsigned int flag_verbose = 1 << 1; static struct settings { unsigned int flags; unsigned short int port; + int verbosity; } settings; int test_flag(unsigned int flag); |