hotspot/src/share/vm/logging/logTag.hpp
changeset 34656 501b8f1784c4
parent 34629 d1e1bfdca413
child 35061 be6025ebffea
equal deleted inserted replaced
34655:d48cb26b07c2 34656:501b8f1784c4
    36   LOG_TAG(gc) \
    36   LOG_TAG(gc) \
    37   LOG_TAG(logging) \
    37   LOG_TAG(logging) \
    38   LOG_TAG(safepoint) \
    38   LOG_TAG(safepoint) \
    39   LOG_TAG(vmoperation)
    39   LOG_TAG(vmoperation)
    40 
    40 
    41 #define PREFIX_LOG_TAG(T) (LogTag::T)
    41 #define PREFIX_LOG_TAG(T) (LogTag::_##T)
    42 
    42 
    43 // Expand a set of log tags to their prefixed names.
    43 // Expand a set of log tags to their prefixed names.
    44 // For error detection purposes, the macro passes one more tag than what is supported.
    44 // For error detection purposes, the macro passes one more tag than what is supported.
    45 // If too many tags are given, a static assert in the log class will fail.
    45 // If too many tags are given, a static assert in the log class will fail.
    46 #define LOG_TAGS_EXPANDED(T0, T1, T2, T3, T4, T5, ...)  PREFIX_LOG_TAG(T0), PREFIX_LOG_TAG(T1), PREFIX_LOG_TAG(T2), \
    46 #define LOG_TAGS_EXPANDED(T0, T1, T2, T3, T4, T5, ...)  PREFIX_LOG_TAG(T0), PREFIX_LOG_TAG(T1), PREFIX_LOG_TAG(T2), \
    47                                                         PREFIX_LOG_TAG(T3), PREFIX_LOG_TAG(T4), PREFIX_LOG_TAG(T5)
    47                                                         PREFIX_LOG_TAG(T3), PREFIX_LOG_TAG(T4), PREFIX_LOG_TAG(T5)
    48 // The EXPAND_VARARGS macro is required for MSVC, or it will resolve the LOG_TAGS_EXPANDED macro incorrectly.
    48 // The EXPAND_VARARGS macro is required for MSVC, or it will resolve the LOG_TAGS_EXPANDED macro incorrectly.
    49 #define EXPAND_VARARGS(x) x
    49 #define EXPAND_VARARGS(x) x
    50 #define LOG_TAGS(...) EXPAND_VARARGS(LOG_TAGS_EXPANDED(__VA_ARGS__, __NO_TAG, __NO_TAG, __NO_TAG, __NO_TAG, __NO_TAG, __NO_TAG))
    50 #define LOG_TAGS(...) EXPAND_VARARGS(LOG_TAGS_EXPANDED(__VA_ARGS__, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG))
    51 
    51 
    52 // Log tags are used to classify log messages.
    52 // Log tags are used to classify log messages.
    53 // Each log message can be assigned between 1 to LogTag::MaxTags number of tags.
    53 // Each log message can be assigned between 1 to LogTag::MaxTags number of tags.
    54 // Specifying multiple tags for a log message means that only outputs configured
    54 // Specifying multiple tags for a log message means that only outputs configured
    55 // for those exact tags, or a subset of the tags with a wildcard, will see the logging.
    55 // for those exact tags, or a subset of the tags with a wildcard, will see the logging.
    61   // but a specific log message can only be tagged with up to MaxTags of those.
    61   // but a specific log message can only be tagged with up to MaxTags of those.
    62   static const size_t MaxTags = 5;
    62   static const size_t MaxTags = 5;
    63 
    63 
    64   enum type {
    64   enum type {
    65     __NO_TAG,
    65     __NO_TAG,
    66 #define LOG_TAG(name) name,
    66 #define LOG_TAG(name) _##name,
    67     LOG_TAG_LIST
    67     LOG_TAG_LIST
    68 #undef LOG_TAG
    68 #undef LOG_TAG
    69     Count
    69     Count
    70   };
    70   };
    71 
    71