Project: /youtube/cobalt/_project.yaml Book: /youtube/cobalt/_book.yaml
log.h
Defines core debug logging functions.
The priority at which a message should be logged. The platform may be configured to filter logs by priority, or render them differently.
kSbLogPriorityUnknown
kSbLogPriorityInfo
kSbLogPriorityWarning
kSbLogPriorityError
kSbLogPriorityFatal
Writes message
to the platform's debug output log. This method is thread-safe, and responsible for ensuring that the output from multiple threads is not mixed.
priority
: The SbLogPriority at which the message should be logged. Note that passing kSbLogPriorityFatal
does not terminate the program. Such a policy must be enforced at the application level. In fact, priority
may be completely ignored on many platforms. message
: The message to be logged. Must not be NULL. No formatting is required to be done on the value, including newline termination. That said, platforms can adjust the message to be more suitable for their output method by wrapping the text, stripping unprintable characters, etc.
void SbLog(SbLogPriority priority, const char *message)
Flushes the log buffer on some platforms. This method is safe to call from multiple threads.
void SbLogFlush()
A log output method that additionally performs a string format on the data being logged.
void SbLogFormat(const char *format, va_list args) SB_PRINTF_FORMAT(1
Inline wrapper of SbLogFormat that converts from ellipsis to va_args.
void static void static void SbLogFormatF(const char *format,...) SB_PRINTF_FORMAT(1
Indicates whether the log output goes to a TTY or is being redirected.
bool SbLogIsTty()
A bare-bones log output method that is async-signal-safe, i.e. safe to call from an asynchronous signal handler (e.g. a SIGSEGV
handler). It should not do any additional formatting.
message
: The message to be logged. Must not be NULL.
void SbLogRaw(const char *message)
Dumps the stack of the current thread to the log in an async-signal-safe manner, i.e. safe to call from an asynchronous signal handler (e.g. a SIGSEGV
handler). Does not include SbLogRawDumpStack itself.
frames_to_skip
: The number of frames to skip from the top of the stack when dumping the current thread to the log. This parameter lets you remove noise from helper functions that might end up on top of every stack dump so that the stack dump is just the relevant function stack where the problem occurred.
void SbLogRawDumpStack(int frames_to_skip)
A formatted log output method that is async-signal-safe, i.e. safe to call from an asynchronous signal handler (e.g. a SIGSEGV
handler).
void SbLogRawFormat(const char *format, va_list args) SB_PRINTF_FORMAT(1
Inline wrapper of SbLogFormat to convert from ellipsis to va_args.
void static void static void SbLogRawFormatF(const char *format,...) SB_PRINTF_FORMAT(1