os: directly set console verbosity level, instead of using LogSetParameter()

No need for extra call to some demuxer function for nothing but setting a
simple int variable. Setting verbosity level really is nothing more than just
writing some value into a variable, so it's trivial to just to do that, instead
of having an unncessarily complex "universal setter" for that.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-09-09 20:40:51 +02:00
parent 7c51bcb093
commit ae7c32abf6
7 changed files with 20 additions and 14 deletions

View File

@@ -113,7 +113,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
static int logFileFd = -1;
static Bool logSync = FALSE;
static int logVerbosity = DEFAULT_LOG_VERBOSITY;
int xorgLogVerbosity = DEFAULT_LOG_VERBOSITY;
static int logFileVerbosity = DEFAULT_LOG_FILE_VERBOSITY;
/* Buffer to information logged before the log file is opened. */
@@ -318,7 +318,7 @@ LogSetParameter(LogParameter param, int value)
logSync = value ? TRUE : FALSE;
return TRUE;
case XLOG_VERBOSITY:
logVerbosity = value;
xorgLogVerbosity = value;
return TRUE;
case XLOG_FILE_VERBOSITY:
logFileVerbosity = value;
@@ -555,7 +555,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
static Bool newline = TRUE;
int ret;
if (verb < 0 || logVerbosity >= verb)
if (verb < 0 || xorgLogVerbosity >= verb)
ret = write(2, buf, len);
if (verb < 0 || logFileVerbosity >= verb) {
@@ -607,7 +607,7 @@ LogMessageTypeVerbString(MessageType type, int verb)
if (type == X_ERROR)
verb = 0;
if (logVerbosity < verb && logFileVerbosity < verb)
if (xorgLogVerbosity < verb && logFileVerbosity < verb)
return NULL;
switch (type) {

View File

@@ -68,4 +68,12 @@ int LogSetParameter(LogParameter param, int value);
#define DebugF(...) /* */
#endif
/**
* @brief console log verbosity (stderr)
*
* The verbosity level of logging to console. All messages with verbosity
* level below this one will be written to stderr
*/
extern int xorgLogVerbosity;
#endif /* __XORG_OS_LOGGING_H */