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

@ -289,10 +289,8 @@ ddxProcessArgument(int argc, char **argv, int i)
}
else if (!strcmp(argv[i], "-verbosity")) {
if (i + 1 < argc && argv[i + 1][0] != '-') {
int verbosity = atoi(argv[i + 1]);
LogSetParameter(XLOG_VERBOSITY, verbosity);
EPHYR_LOG("set verbosiry to %d\n", verbosity);
xorgLogVerbosity = atoi(argv[i + 1]);
EPHYR_LOG("set verbosiry to %d\n", xorgLogVerbosity);
return 2;
}
else {

View File

@ -868,7 +868,7 @@ void
xf86SetVerbosity(int verb)
{
xf86Verbose = verb;
LogSetParameter(XLOG_VERBOSITY, verb);
xorgLogVerbosity = verb;
}
void

View File

@ -234,11 +234,11 @@ ddxProcessArgument(int argc, char *argv[], int i)
val = strtol(argv[i], &end, 0);
if (*end == '\0') {
verbosity = val;
LogSetParameter(XLOG_VERBOSITY, verbosity);
xorgLogVerbosity = verbosity;
return 2;
}
}
LogSetParameter(XLOG_VERBOSITY, ++verbosity);
xorgLogVerbosity = ++verbosity;
return 1;
}
else if (strcmp(argv[i], "-version") == 0) {

View File

@ -534,7 +534,7 @@ OsVendorInit(void)
g_pszLogFile = LogInit(g_pszLogFile, ".old");
}
LogSetParameter(XLOG_VERBOSITY, g_iLogVerbose);
xorgLogVerbosity = g_iLogVerbose;
LogSetParameter(XLOG_FILE_VERBOSITY, g_iLogVerbose);
/* Log the version information */

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 */

View File

@ -150,7 +150,7 @@ number_formatting(void)
-0x7FFFFFFFFFFFFFFF, /* Maximum 64-bit signed number */
} ;
LogSetParameter(XLOG_VERBOSITY, -1);
xorgLogVerbosity = -1;
for (i = 0; i < ARRAY_SIZE(unsigned_tests); i++)
assert(check_number_format_test(unsigned_tests[i]));
@ -182,7 +182,7 @@ static void logging_format(void)
uintptr_t ptr;
char *fname = NULL;
LogSetParameter(XLOG_VERBOSITY, -1);
xorgLogVerbosity = -1;
/* set up buf to contain ".....end" */
memset(buf, '.', sizeof(buf));