Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable/parameter which indicates the state of the FVWM3 logging #239

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/fvwm/expansion.xml
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,15 @@ command can be used:</para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$[debuglog.state]</term>
<listitem>
<para>
Either <replaceable>0</replaceable> (debug log closed) or <replaceable>1</replaceable>.
Indicates the current state of debuging and logging facility.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>$[gt.<replaceable>str</replaceable>]</term>
<listitem>
Expand Down
7 changes: 7 additions & 0 deletions fvwm/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "libs/charmap.h"
#include "libs/wcontext.h"
#include "libs/Fsvg.h"
#include "libs/log.h"

/* ---------------------------- local definitions -------------------------- */

Expand Down Expand Up @@ -79,6 +80,7 @@ static char *function_vars[] =
"cw.width",
"cw.x",
"cw.y",
"debuglog.state",
"desk.height",
"desk.n",
"desk.pagesx",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions libs/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down