Skip to content

Commit af304de

Browse files
authored
DPL: add signposts replacement for LOG(alarm) / LOG(important) (#14468)
1 parent 678b1ae commit af304de

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Framework/Foundation/include/Framework/Signpost.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,26 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
562562
O2_LOG_MACRO_RAW(critical, remove_engineering_type(format).data(), ##__VA_ARGS__); \
563563
})
564564

565+
// Similar to the above, however it will also print a normal alarm message regardless of the signpost being enabled or not.
566+
#define O2_SIGNPOST_EVENT_EMIT_ALARM(log, id, name, format, ...) __extension__({ \
567+
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
568+
O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ##__VA_ARGS__); \
569+
} else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \
570+
_o2_signpost_event_emit(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \
571+
} \
572+
O2_LOG_MACRO_RAW(alarm, remove_engineering_type(format).data(), ##__VA_ARGS__); \
573+
})
574+
575+
// Similar to the above, however it will also print a normal alarm message regardless of the signpost being enabled or not.
576+
#define O2_SIGNPOST_EVENT_EMIT_IMPORTANT(log, id, name, format, ...) __extension__({ \
577+
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
578+
O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ##__VA_ARGS__); \
579+
} else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \
580+
_o2_signpost_event_emit(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \
581+
} \
582+
O2_LOG_MACRO_RAW(important, remove_engineering_type(format).data(), ##__VA_ARGS__); \
583+
})
584+
565585
#define O2_SIGNPOST_START(log, id, name, format, ...) \
566586
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
567587
O2_SIGNPOST_START_MAC(log, id, name, format, ##__VA_ARGS__); \

0 commit comments

Comments
 (0)