8143229: Replace the develop level with develop macros in Unified Logging
Reviewed-by: brutisso, coleenp, dholmes, rprotacio
This commit is contained in:
parent
dd059bb29f
commit
961fbacd76
@ -37,10 +37,10 @@ void Test_log_length() {
|
|||||||
|
|
||||||
// Write long message to output file
|
// Write long message to output file
|
||||||
MutexLocker ml(LogConfiguration_lock);
|
MutexLocker ml(LogConfiguration_lock);
|
||||||
LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=develop",
|
LogConfiguration::parse_log_arguments("loglengthoutput.txt", "logging=trace",
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
outputStream* logstream = LogHandle(logging)::develop_stream();
|
outputStream* logstream = LogHandle(logging)::trace_stream();
|
||||||
logstream->print_cr("01:1234567890-"
|
logstream->print_cr("01:1234567890-"
|
||||||
"02:1234567890-"
|
"02:1234567890-"
|
||||||
"03:1234567890-"
|
"03:1234567890-"
|
||||||
|
@ -49,11 +49,21 @@
|
|||||||
#define log_info(...) (!log_is_enabled(Info, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
|
#define log_info(...) (!log_is_enabled(Info, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
|
||||||
#define log_debug(...) (!log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
|
#define log_debug(...) (!log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
|
||||||
#define log_trace(...) (!log_is_enabled(Trace, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
|
#define log_trace(...) (!log_is_enabled(Trace, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
|
||||||
|
|
||||||
|
// Macros for logging that should be excluded in product builds.
|
||||||
|
// Available for levels Info, Debug and Trace. Includes test macro that
|
||||||
|
// evaluates to false in product builds.
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
#define log_develop(...) (!log_is_enabled(Develop, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Develop>
|
#define log_develop_info(...) (!log_is_enabled(Info, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
|
||||||
|
#define log_develop_debug(...) (!log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
|
||||||
|
#define log_develop_trace(...) (!log_is_enabled(Trace, __VA_ARGS__)) ? (void)0 : Log<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
|
||||||
|
#define develop_log_is_enabled(level, ...) log_is_enabled(level, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define DUMMY_ARGUMENT_CONSUMER(...)
|
#define DUMMY_ARGUMENT_CONSUMER(...)
|
||||||
#define log_develop(...) DUMMY_ARGUMENT_CONSUMER
|
#define log_develop_info(...) DUMMY_ARGUMENT_CONSUMER
|
||||||
|
#define log_develop_debug(...) DUMMY_ARGUMENT_CONSUMER
|
||||||
|
#define log_develop_trace(...) DUMMY_ARGUMENT_CONSUMER
|
||||||
|
#define develop_log_is_enabled(...) false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convenience macro to test if the logging is enabled on the specified level for given tags.
|
// Convenience macro to test if the logging is enabled on the specified level for given tags.
|
||||||
|
@ -44,6 +44,7 @@ void LogConfiguration::post_initialize() {
|
|||||||
LogDiagnosticCommand::registerCommand();
|
LogDiagnosticCommand::registerCommand();
|
||||||
LogHandle(logging) log;
|
LogHandle(logging) log;
|
||||||
log.info("Log configuration fully initialized.");
|
log.info("Log configuration fully initialized.");
|
||||||
|
log_develop_info(logging)("Develop logging is available.");
|
||||||
if (log.is_trace()) {
|
if (log.is_trace()) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
MutexLocker ml(LogConfiguration_lock);
|
MutexLocker ml(LogConfiguration_lock);
|
||||||
|
@ -29,14 +29,8 @@
|
|||||||
|
|
||||||
// The list of log levels:
|
// The list of log levels:
|
||||||
//
|
//
|
||||||
// develop - A non-product level that is finer than trace.
|
// trace - Finest level of logging. Use for extensive/noisy
|
||||||
// Should be used for really expensive and/or
|
// logging that can give slow-down when enabled.
|
||||||
// extensive logging, or logging that shouldn't
|
|
||||||
// or can't be included in a product build.
|
|
||||||
//
|
|
||||||
// trace - Finest level of logging in product builds.
|
|
||||||
// Use for extensive/noisy logging that can
|
|
||||||
// give slow-down when enabled.
|
|
||||||
//
|
//
|
||||||
// debug - A finer level of logging. Use for semi-noisy
|
// debug - A finer level of logging. Use for semi-noisy
|
||||||
// logging that is does not fit the info level.
|
// logging that is does not fit the info level.
|
||||||
@ -49,7 +43,6 @@
|
|||||||
// error - Critical messages caused by errors.
|
// error - Critical messages caused by errors.
|
||||||
//
|
//
|
||||||
#define LOG_LEVEL_LIST \
|
#define LOG_LEVEL_LIST \
|
||||||
NOT_PRODUCT(LOG_LEVEL(Develop, develop)) \
|
|
||||||
LOG_LEVEL(Trace, trace) \
|
LOG_LEVEL(Trace, trace) \
|
||||||
LOG_LEVEL(Debug, debug) \
|
LOG_LEVEL(Debug, debug) \
|
||||||
LOG_LEVEL(Info, info) \
|
LOG_LEVEL(Info, info) \
|
||||||
|
Loading…
Reference in New Issue
Block a user