aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2021-06-26 21:15:09 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2021-06-26 21:15:09 +0000
commit5dca0458a09ebc586fda49c50533976f055d8de2 (patch)
tree9e1f768a9e3302fe5048a8d3a86cb614a8a57e5e /main.c
parentvt: don’t reset utf8proc grapheme state when we’re not at a grapheme break (diff)
log: add LOG_CLASS_NONE and use as initializer for log_level
This means that logging will be completely disabled until log_init() has been called, which is useful to prevent log spam when running UNITTEST{} blocks in debug builds. Note that this doesn't change the default log level at runtime, which was already being set to LOG_CLASS_INFO in main.c and client.c. The new log level is also exposed to the command-line interface as `--log-level=none`, which allows disabling logging entirely.
Diffstat (limited to 'main.c')
-rw-r--r--main.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/main.c b/main.c
index bbe89052..f58bdb52 100644
--- a/main.c
+++ b/main.c
@@ -61,27 +61,27 @@ print_usage(const char *prog_name)
"Usage: %s [OPTIONS...] command [ARGS...]\n"
"\n"
"Options:\n"
- " -c,--config=PATH load configuration from PATH ($XDG_CONFIG_HOME/foot/foot.ini)\n"
- " -C,--check-config verify configuration, exit with 0 if ok, otherwise exit with 1\n"
- " -o,--override=[section.]key=value override configuration option\n"
- " -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n"
- " -t,--term=TERM value to set the environment variable TERM to (%s)\n"
- " -T,--title=TITLE initial window title (foot)\n"
- " -a,--app-id=ID window application ID (foot)\n"
- " -m,--maximized start in maximized mode\n"
- " -F,--fullscreen start in fullscreen mode\n"
- " -L,--login-shell start shell as a login shell\n"
- " -D,--working-directory=DIR directory to start in (CWD)\n"
- " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
- " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
- " -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n"
- " Without PATH, $XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock will be used.\n"
- " -H,--hold remain open after child process exits\n"
- " -p,--print-pid=FILE|FD print PID to file or FD (only applicable in server mode)\n"
- " -d,--log-level={info|warning|error} log level (info)\n"
- " -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
- " -s,--log-no-syslog disable syslog logging (only applicable in server mode)\n"
- " -v,--version show the version number and quit\n",
+ " -c,--config=PATH load configuration from PATH ($XDG_CONFIG_HOME/foot/foot.ini)\n"
+ " -C,--check-config verify configuration, exit with 0 if ok, otherwise exit with 1\n"
+ " -o,--override=[section.]key=value override configuration option\n"
+ " -f,--font=FONT comma separated list of fonts in fontconfig format (monospace)\n"
+ " -t,--term=TERM value to set the environment variable TERM to (%s)\n"
+ " -T,--title=TITLE initial window title (foot)\n"
+ " -a,--app-id=ID window application ID (foot)\n"
+ " -m,--maximized start in maximized mode\n"
+ " -F,--fullscreen start in fullscreen mode\n"
+ " -L,--login-shell start shell as a login shell\n"
+ " -D,--working-directory=DIR directory to start in (CWD)\n"
+ " -w,--window-size-pixels=WIDTHxHEIGHT initial width and height, in pixels\n"
+ " -W,--window-size-chars=WIDTHxHEIGHT initial width and height, in characters\n"
+ " -s,--server[=PATH] run as a server (use 'footclient' to start terminals).\n"
+ " Without PATH, $XDG_RUNTIME_DIR/foot-$WAYLAND_DISPLAY.sock will be used.\n"
+ " -H,--hold remain open after child process exits\n"
+ " -p,--print-pid=FILE|FD print PID to file or FD (only applicable in server mode)\n"
+ " -d,--log-level={info|warning|error|none} log level (info)\n"
+ " -l,--log-colorize=[{never|always|auto}] enable/disable colorization of log output on stderr\n"
+ " -s,--log-no-syslog disable syslog logging (only applicable in server mode)\n"
+ " -v,--version show the version number and quit\n",
prog_name, prog_name, DEFAULT_TERM);
}
@@ -383,11 +383,14 @@ main(int argc, char *const *argv)
log_init(log_colorize, as_server && log_syslog,
as_server ? LOG_FACILITY_DAEMON : LOG_FACILITY_USER, log_level);
- _Static_assert(LOG_CLASS_ERROR + 1 == FCFT_LOG_CLASS_ERROR,
+ _Static_assert((int)LOG_CLASS_ERROR == (int)FCFT_LOG_CLASS_ERROR,
"fcft log level enum offset");
_Static_assert((int)LOG_COLORIZE_ALWAYS == (int)FCFT_LOG_COLORIZE_ALWAYS,
"fcft colorize enum mismatch");
- fcft_log_init((enum fcft_log_colorize)log_colorize, as_server && log_syslog, log_level + 1);
+ fcft_log_init(
+ (enum fcft_log_colorize)log_colorize,
+ as_server && log_syslog,
+ (enum fcft_log_class)log_level);
argc -= optind;
argv += optind;