72 LOG_TAG(start) \
73 LOG_TAG(state) \
74 LOG_TAG(stats) \
75 LOG_TAG(stringdedup) \
76 LOG_TAG(survivor) \
77 LOG_TAG(svc) \
78 LOG_TAG(sweep) \
79 LOG_TAG(task) \
80 LOG_TAG(tlab) \
81 LOG_TAG(time) \
82 LOG_TAG(verify) \
83 LOG_TAG(vmoperation)
84
85 #define PREFIX_LOG_TAG(T) (LogTag::_##T)
86
87 // Expand a set of log tags to their prefixed names.
88 // For error detection purposes, the macro passes one more tag than what is supported.
89 // If too many tags are given, a static assert in the log class will fail.
90 #define LOG_TAGS_EXPANDED(T0, T1, T2, T3, T4, T5, ...) PREFIX_LOG_TAG(T0), PREFIX_LOG_TAG(T1), PREFIX_LOG_TAG(T2), \
91 PREFIX_LOG_TAG(T3), PREFIX_LOG_TAG(T4), PREFIX_LOG_TAG(T5)
92 // The EXPAND_VARARGS macro is required for MSVC, or it will resolve the LOG_TAGS_EXPANDED macro incorrectly.
93 #define EXPAND_VARARGS(x) x
94 #define LOG_TAGS(...) EXPAND_VARARGS(LOG_TAGS_EXPANDED(__VA_ARGS__, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG))
95
96 // Log tags are used to classify log messages.
97 // Each log message can be assigned between 1 to LogTag::MaxTags number of tags.
98 // Specifying multiple tags for a log message means that only outputs configured
99 // for those exact tags, or a subset of the tags with a wildcard, will see the logging.
100 // Multiple tags should be comma separated, e.g. log_error(tag1, tag2)("msg").
101 class LogTag : public AllStatic {
102 public:
103 // The maximum number of tags that a single log message can have.
104 // E.g. there might be hundreds of different tags available,
105 // but a specific log message can only be tagged with up to MaxTags of those.
106 static const size_t MaxTags = 5;
107
108 enum type {
109 __NO_TAG,
110 #define LOG_TAG(name) _##name,
111 LOG_TAG_LIST
112 #undef LOG_TAG
113 Count
114 };
115
|
72 LOG_TAG(start) \
73 LOG_TAG(state) \
74 LOG_TAG(stats) \
75 LOG_TAG(stringdedup) \
76 LOG_TAG(survivor) \
77 LOG_TAG(svc) \
78 LOG_TAG(sweep) \
79 LOG_TAG(task) \
80 LOG_TAG(tlab) \
81 LOG_TAG(time) \
82 LOG_TAG(verify) \
83 LOG_TAG(vmoperation)
84
85 #define PREFIX_LOG_TAG(T) (LogTag::_##T)
86
87 // Expand a set of log tags to their prefixed names.
88 // For error detection purposes, the macro passes one more tag than what is supported.
89 // If too many tags are given, a static assert in the log class will fail.
90 #define LOG_TAGS_EXPANDED(T0, T1, T2, T3, T4, T5, ...) PREFIX_LOG_TAG(T0), PREFIX_LOG_TAG(T1), PREFIX_LOG_TAG(T2), \
91 PREFIX_LOG_TAG(T3), PREFIX_LOG_TAG(T4), PREFIX_LOG_TAG(T5)
92 // Generate a comma separated list of the first 6 tags.
93 #define VAR_LOG_TAGS_EXPANDED(V0, V1, V2, V3, V4, V5, ...) V0, V1, V2, V3, V4, V5
94 // The EXPAND_VARARGS macro is required for MSVC, or it will resolve the LOG_TAGS_EXPANDED macro incorrectly.
95 #define EXPAND_VARARGS(x) x
96 #define VAR_LOG_TAGS(...) EXPAND_VARARGS(VAR_LOG_TAGS_EXPANDED(__VA_ARGS__, PREFIX_LOG_TAG(_NO_TAG), PREFIX_LOG_TAG(_NO_TAG), \
97 PREFIX_LOG_TAG(_NO_TAG), PREFIX_LOG_TAG(_NO_TAG), \
98 PREFIX_LOG_TAG(_NO_TAG), PREFIX_LOG_TAG(_NO_TAG)))
99 #define LOG_TAGS(...) EXPAND_VARARGS(LOG_TAGS_EXPANDED(__VA_ARGS__, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG))
100 // Log tags are used to classify log messages.
101 // Each log message can be assigned between 1 to LogTag::MaxTags number of tags.
102 // Specifying multiple tags for a log message means that only outputs configured
103 // for those exact tags, or a subset of the tags with a wildcard, will see the logging.
104 // Multiple tags should be comma separated, e.g. log_error(tag1, tag2)("msg").
105 class LogTag : public AllStatic {
106 public:
107 // The maximum number of tags that a single log message can have.
108 // E.g. there might be hundreds of different tags available,
109 // but a specific log message can only be tagged with up to MaxTags of those.
110 static const size_t MaxTags = 5;
111
112 enum type {
113 __NO_TAG,
114 #define LOG_TAG(name) _##name,
115 LOG_TAG_LIST
116 #undef LOG_TAG
117 Count
118 };
119
|