Skip to content

Commit 0518362

Browse files
ehellbarktf
authored andcommitted
Adding O2_SIGNPOST_EVENT_EMIT_CRITICAL macro
1 parent a7da0ce commit 0518362

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Framework/Foundation/include/Framework/Signpost.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,16 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
531531
O2_LOG_MACRO_RAW(warn, remove_engineering_type(format).data(), ##__VA_ARGS__); \
532532
})
533533

534+
// Similar to the above, however it will also print a normal critical message regardless of the signpost being enabled or not.
535+
#define O2_SIGNPOST_EVENT_EMIT_CRITICAL(log, id, name, format, ...) __extension__({ \
536+
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
537+
O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ##__VA_ARGS__); \
538+
} else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \
539+
_o2_signpost_event_emit(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \
540+
} \
541+
O2_LOG_MACRO_RAW(critical, remove_engineering_type(format).data(), ##__VA_ARGS__); \
542+
})
543+
534544
#define O2_SIGNPOST_START(log, id, name, format, ...) \
535545
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
536546
O2_SIGNPOST_START_MAC(log, id, name, format, ##__VA_ARGS__); \

0 commit comments

Comments
 (0)