From 34c707304b16c83f0ba711c6f6b35f4168791ffb Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 10 Nov 2015 12:05:23 +0100 Subject: [PATCH] wlog: change variable naming and fix documentation * change State to active and make it BOOL since it's only got two used values * fix some typos in the documentation --- docs/wlog.md | 14 ++++++++++---- winpr/libwinpr/utils/wlog/Appender.c | 8 ++++---- winpr/libwinpr/utils/wlog/wlog.c | 8 ++++---- winpr/libwinpr/utils/wlog/wlog.h | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/wlog.md b/docs/wlog.md index 729d80461..e6d1286ae 100644 --- a/docs/wlog.md +++ b/docs/wlog.md @@ -12,7 +12,13 @@ TODO add more details and configuration examples. # Environment variables -* WLOG_APPENDER - the appender to use +* WLOG_APPENDER - the appender to use possible values below also see the Appender section. + * CONSOLE + * FILE + * BINARY + * SYSLOG + * JOURNALD + * UDP * WLOG_PREFIX - configure the prefix used for outputting the message (see Format for more details and examples) * WLOG_LEVEL - the level to output messages for @@ -34,7 +40,7 @@ The level list below is top down. Top the highest level. * WLOG_DEBUG - debug messages * WLOG_INFO - general informations * WLOG_WARN - warnings -* WLOG_ERROR - error +* WLOG_ERROR - errors * WLOG_FATAL - fatal problems * WLOG_OFF - completely disable the wlog output @@ -56,7 +62,7 @@ The format a logger prints in has the following possible options: * "hr" - hour * "mi" - minute * "se" - second -* "ml" - milliseconds +* "ml" - millisecond A maximum of 16 options can be used per format string. @@ -118,7 +124,7 @@ Options: ### Udp -This appender sends the loging messages to a pre-defined remote host via UDP. +This appender sends the logging messages to a pre-defined remote host via UDP. Options: diff --git a/winpr/libwinpr/utils/wlog/Appender.c b/winpr/libwinpr/utils/wlog/Appender.c index 8946d9695..461023fea 100644 --- a/winpr/libwinpr/utils/wlog/Appender.c +++ b/winpr/libwinpr/utils/wlog/Appender.c @@ -62,10 +62,10 @@ BOOL WLog_OpenAppender(wLog* log) if (!appender->Open) return TRUE; - if (!appender->State) + if (!appender->active) { status = appender->Open(log, appender); - appender->State = 1; + appender->active = TRUE; } return status; @@ -84,10 +84,10 @@ BOOL WLog_CloseAppender(wLog* log) if (!appender->Close) return TRUE; - if (appender->State) + if (appender->active) { status = appender->Close(log, appender); - appender->State = 0; + appender->active = FALSE; } return status; diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 8a3416448..5526e693e 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -120,7 +120,7 @@ BOOL WLog_Write(wLog* log, wLogMessage* message) if (!appender) return FALSE; - if (!appender->State) + if (!appender->active) if (!WLog_OpenAppender(log)) return FALSE; @@ -151,7 +151,7 @@ BOOL WLog_WriteData(wLog* log, wLogMessage* message) if (!appender) return FALSE; - if (!appender->State) + if (!appender->active) if (!WLog_OpenAppender(log)) return FALSE; @@ -182,7 +182,7 @@ BOOL WLog_WriteImage(wLog* log, wLogMessage* message) if (!appender) return FALSE; - if (!appender->State) + if (!appender->active) if (!WLog_OpenAppender(log)) return FALSE; @@ -213,7 +213,7 @@ BOOL WLog_WritePacket(wLog* log, wLogMessage* message) if (!appender) return FALSE; - if (!appender->State) + if (!appender->active) if (!WLog_OpenAppender(log)) return FALSE; diff --git a/winpr/libwinpr/utils/wlog/wlog.h b/winpr/libwinpr/utils/wlog/wlog.h index 5f8dd55c9..c3cc83e70 100644 --- a/winpr/libwinpr/utils/wlog/wlog.h +++ b/winpr/libwinpr/utils/wlog/wlog.h @@ -37,7 +37,7 @@ typedef void (*WLOG_APPENDER_FREE)(wLogAppender* appender); #define WLOG_APPENDER_COMMON() \ DWORD Type; \ - DWORD State; \ + BOOL active; \ wLogLayout* Layout; \ CRITICAL_SECTION lock; \ BOOL recursive; \