Skip to content

Commit a956817

Browse files
committed
DPL: make log messages optional as well
1 parent 5e22763 commit a956817

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Framework/Foundation/include/Framework/Signpost.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,13 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
460460
#define O2_LOG_DISABLE(log) _o2_log_set_stacktrace(private_o2_log_##log, 0)
461461
// For the moment we simply use LOG DEBUG. We should have proper activities so that we can
462462
// turn on and off the printing.
463-
#define O2_LOG_DEBUG(log, ...) O2_LOG_MACRO(__VA_ARGS__)
463+
#define O2_LOG_DEBUG(log, ...) __extension__({ \
464+
if (O2_BUILTIN_UNLIKELY(O2_LOG_ENABLED(log))) { \
465+
O2_LOG_MACRO(__VA_ARGS__); \
466+
} else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \
467+
O2_LOG_MACRO(__VA_ARGS__); \
468+
} \
469+
})
464470
#define O2_SIGNPOST_ID_FROM_POINTER(name, log, pointer) _o2_signpost_id_t name = _o2_signpost_id_make_with_pointer(private_o2_log_##log, pointer)
465471
#define O2_SIGNPOST_ID_GENERATE(name, log) _o2_signpost_id_t name = _o2_signpost_id_generate_local(private_o2_log_##log)
466472
// In case Instruments is attached, we switch to the Apple signpost API otherwise, both one

0 commit comments

Comments
 (0)