Skip to content

Commit

Permalink
Merge pull request #583 from mkilgore/logging-constants
Browse files Browse the repository at this point in the history
Add logging Constants, Adjust _LogMinLevel
  • Loading branch information
mkilgore authored Dec 6, 2024
2 parents 576fec0 + 52cd8d7 commit 4df9258
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/c/libqb/src/logging/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ static uint8_t enabled_scopes[static_cast<std::size_t>(logscope::Count)] = {
};

uint32_t func__logminlevel() {
if (!logging_enabled)
return 5;

switch (minimum_level) {
case loglevel::Trace: return 1;
case loglevel::Information: return 2;
case loglevel::Warning: return 3;
case loglevel::Error: return 4;
}

return 1;
return 5;
}

const char *logLevelName(loglevel lvl) {
Expand Down
6 changes: 6 additions & 0 deletions internal/support/include/beforefirstline.bi
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,9 @@ CONST _ERR_PATH_FILE_ACCESS_ERROR = 75
CONST _ERR_PATH_NOT_FOUND = 76
CONST _ERR_INVALID_HANDLE = 258

' Logging constants for _LOGMINLEVEL
CONST _LOG_TRACE = 1
CONST _LOG_INFO = 2
CONST _LOG_WARN = 3
CONST _LOG_ERROR = 4
CONST _LOG_NONE = 5
4 changes: 4 additions & 0 deletions tests/compile_tests/logging/consts.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$Console:Only

Print _LOG_TRACE; _LOG_INFO; _LOG_WARN; _LOG_ERROR
System
1 change: 1 addition & 0 deletions tests/compile_tests/logging/consts.output
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 2 3 4

0 comments on commit 4df9258

Please sign in to comment.