mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
1. Support Java/log4j log level text. 2. Support configuring by `--log-new-level=on` which is enabled by default. 3. Support `--log-new-level=off` to use SRS 4.0 log level for compatibility.
This commit is contained in:
parent
20c38e07c0
commit
2d1ba46e37
14 changed files with 147 additions and 24 deletions
|
@ -8,14 +8,25 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
|
||||
// Go log level: Info, Warning, Error, Fatal, see https://github.com/golang/glog/blob/master/glog.go#L17
|
||||
// Java log level: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, see https://stackoverflow.com/a/2031209/17679565
|
||||
// or https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-api/src/main/java/org/apache/logging/log4j/Level.java#L29
|
||||
const char* srs_log_level_strings[] = {
|
||||
"Forbidden",
|
||||
"Verb",
|
||||
"Debug", NULL,
|
||||
"Trace", NULL, NULL, NULL,
|
||||
"Warn", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"Error", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"Disabled",
|
||||
#ifdef SRS_LOG_LEVEL_V2
|
||||
// The v2 log level specs by log4j.
|
||||
"FORB", "TRACE", "DEBUG", NULL, "INFO", NULL, NULL, NULL,
|
||||
"WARN", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"ERROR", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"OFF",
|
||||
#else
|
||||
// SRS 4.0 level definition, to keep compatible.
|
||||
"Forb", "Verb", "Debug", NULL, "Trace", NULL, NULL, NULL,
|
||||
"Warn", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"Error", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"Off",
|
||||
#endif
|
||||
};
|
||||
|
||||
ISrsLog::ISrsLog()
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
|
||||
#include <srs_kernel_consts.hpp>
|
||||
|
||||
// The log level, for example:
|
||||
// if specified Debug level, all level messages will be logged.
|
||||
// if specified Warn level, only Warn/Error/Fatal level messages will be logged.
|
||||
// The log level, see https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-api/src/main/java/org/apache/logging/log4j/Level.java
|
||||
// Please note that the enum name might not be the string, to keep compatible with previous definition.
|
||||
enum SrsLogLevel
|
||||
{
|
||||
SrsLogLevelForbidden = 0x00,
|
||||
|
||||
// Only used for very verbose debug, generally,
|
||||
// we compile without this level for high performance.
|
||||
SrsLogLevelVerbose = 0x01,
|
||||
|
@ -31,6 +31,7 @@ enum SrsLogLevel
|
|||
SrsLogLevelTrace = 0x04,
|
||||
SrsLogLevelWarn = 0x08,
|
||||
SrsLogLevelError = 0x10,
|
||||
|
||||
SrsLogLevelDisabled = 0x20,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue