Starboard Module Reference: log.h

Defines core debug logging functions.

Enums

SbLogPriority

Specifies the priority at which a message is logged. The platform can filter logs by priority or render them differently.

Values

  • kSbLogPriorityUnknown
  • kSbLogPriorityInfo
  • kSbLogPriorityWarning
  • kSbLogPriorityError
  • kSbLogPriorityFatal

Functions

SbLog

Writes message to the platform's debug output log. This method is thread-safe and ensures that output from multiple threads is not interleaved.

  • priority: The SbLogPriority at which the message is logged. Note that passing kSbLogPriorityFatal does not terminate the program; the application must enforce termination. Many platforms ignore this parameter.

  • message: The message to log. Must not be NULL. No formatting is required, including newline termination. Platforms can adjust the message to fit their output method. For example, they can wrap the text or strip unprintable characters.

Declaration

void SbLog(SbLogPriority priority, const char *message)

SbLogFlush

Flushes the log buffer on some platforms. This method is safe to call from multiple threads.

Declaration

void SbLogFlush()

SbLogFormat

A log output method that also formats the logged data.

Declaration

void SbLogFormat(const char *format, va_list args) SB_PRINTF_FORMAT(1

SbLogFormatF

Inline wrapper of SbLogFormat that converts from ellipsis to va_args.

Declaration

void static void static void SbLogFormatF(const char *format,...) SB_PRINTF_FORMAT(1

SbLogRaw

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.

Declaration

void SbLogRaw(const char *message)

SbLogRawDumpStack

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.

Declaration

void SbLogRawDumpStack(int frames_to_skip)

SbLogRawFormat

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).

Declaration

void SbLogRawFormat(const char *format, va_list args) SB_PRINTF_FORMAT(1

SbLogRawFormatF

Inline wrapper of SbLogFormat to convert from ellipsis to va_args.

Declaration

void static void static void SbLogRawFormatF(const char *format,...) SB_PRINTF_FORMAT(1