From 39ce99c84bf81b70e0d7d52add3c093cd58beaba Mon Sep 17 00:00:00 2001 From: Hegel3DReloaded Date: Fri, 2 Oct 2020 09:32:49 +0200 Subject: [PATCH] Add variable/parameter which indicates the state of the FVWM3 logging --- doc/fvwm/expansion.xml | 9 +++++++++ fvwm/expand.c | 7 +++++++ libs/log.c | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/doc/fvwm/expansion.xml b/doc/fvwm/expansion.xml index 92b2352cc..ab72a0f37 100644 --- a/doc/fvwm/expansion.xml +++ b/doc/fvwm/expansion.xml @@ -517,6 +517,15 @@ command can be used: + + $[debuglog.state] + + + Either 0 (debug log closed) or 1. + Indicates the current state of debuging and logging facility. + + + $[gt.str] diff --git a/fvwm/expand.c b/fvwm/expand.c index 5acd545b2..c4bbdbc4b 100644 --- a/fvwm/expand.c +++ b/fvwm/expand.c @@ -41,6 +41,7 @@ #include "libs/charmap.h" #include "libs/wcontext.h" #include "libs/Fsvg.h" +#include "libs/log.h" /* ---------------------------- local definitions -------------------------- */ @@ -79,6 +80,7 @@ static char *function_vars[] = "cw.width", "cw.x", "cw.y", + "debuglog.state", "desk.height", "desk.n", "desk.pagesx", @@ -167,6 +169,7 @@ enum VAR_CW_WIDTH, VAR_CW_X, VAR_CW_Y, + VAR_DEBUG_LOG_STATE, VAR_DESK_HEIGHT, VAR_DESK_N, VAR_DESK_PAGESX, @@ -1056,6 +1059,10 @@ static signed int expand_vars_extended( target[0] = wcontext_wcontext_to_char(exc->w.wcontext); target[1] = '\0'; break; + case VAR_DEBUG_LOG_STATE: + is_numeric = True; + val = log_get_level(); + break; default: /* unknown variable - try to find it in the environment */ string = getenv(var_name); diff --git a/libs/log.c b/libs/log.c index 25b9942bd..2f33712cd 100644 --- a/libs/log.c +++ b/libs/log.c @@ -43,6 +43,12 @@ log_set_level(int ll) log_level = ll; } +/* Get log level. */ +int log_get_level(void) +{ + return log_level; +} + /* Open logging to file. */ void log_open(const char *fvwm_userdir)