Starboard Module Reference: log.h

Defines debug logging functions.

Enums

SbLogPriority

The priority at which a message should be logged. The platform may be configured to filter logs by priority, or render them differently.

Values

  • kSbLogPriorityUnknown
  • kSbLogPriorityInfo
  • kSbLogPriorityWarning
  • kSbLogPriorityError
  • kSbLogPriorityFatal

Macros

SB_CHECK

Note that this macro's definition varies depending on the values of one or more other variables.

SB_DCHECK

Note that this macro's definition varies depending on the values of one or more other variables.

SB_DLOG

SB_DLOG_IF

Note that this macro's definition varies depending on the values of one or more other variables.

SB_DLOG_IS_ON

Note that this macro's definition varies depending on the values of one or more other variables.

SB_DSTACK

SB_EAT_STREAM_PARAMETERS

SB_LAZY_STREAM

SB_LOG

SB_LOGGING_IS_OFFICIAL_BUILD

Note that this macro's definition varies depending on the values of one or more other variables.

SB_LOG_IF

SB_LOG_IS_ON

SB_LOG_MESSAGE_0

Compatibility with base/logging.h which defines ERROR to be 0 to workaround some system header defines that do the same thing.

SB_LOG_MESSAGE_ERROR

SB_LOG_MESSAGE_FATAL

SB_LOG_MESSAGE_INFO

SB_LOG_MESSAGE_WARNING

SB_LOG_STREAM

SB_NOTIMPLEMENTED

Note that this macro's definition varies depending on the values of one or more other variables.

SB_NOTIMPLEMENTED_IN

SB_NOTIMPLEMENTED_MSG

Note that this macro's definition varies depending on the values of one or more other variables.

SB_NOTIMPLEMENTED_POLICY

Note that this macro's definition varies depending on the values of one or more other variables.

SB_NOTREACHED

Note that this macro's definition varies depending on the values of one or more other variables.

SB_STACK

SB_STACK_IF

Functions

Break

Declaration

SB_EXPORT void Break();

GetMinLogLevel

Declaration

SB_EXPORT SbLogPriority GetMinLogLevel();

SbLog

Description

Writes message to the platform's debug output log.

Declaration and definitions

SB_EXPORT void SbLog(SbLogPriority priority, const char* message);

#include "starboard/log.h"

void SbLog(SbLogPriority /*priority*/, const char* /*message*/) {
}

Parameters

Parameters
SbLogPriority
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.
const char*
message
The message to be logged. 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.

SbLogFlush

Description

Flushes the log buffer on some platforms.

Declaration and definitions

SB_EXPORT void SbLogFlush();

#include "starboard/log.h"

void SbLogFlush() {
}

SbLogFormat

Description

A log output method that additionally performs a string format on the data being logged.

Declaration and definitions

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

#include "starboard/log.h"

void SbLogFormat(const char* /*format*/, va_list /*arguments*/) {
}

Parameters

Parameters
const char*
format
va_list
args

SbLogFormatF

Description

Inline wrapper of SbLogFormat that converts from ellipsis to va_args.

Declaration

static SB_C_INLINE void SbLogFormatF(const char* format, ...)
    SB_PRINTF_FORMAT(1, 2);
void SbLogFormatF(const char* format, ...) {
  va_list args;
  va_start(args, format);
  SbLogFormat(format, args);
  va_end(args);
}

Parameters

Parameters
const char*
format

...

SbLogIsTty

Description

Indicates whether the log output goes to a TTY or is being redirected.

Declaration and definitions

SB_EXPORT bool SbLogIsTty();

#include "starboard/log.h"

bool SbLogIsTty() {
  return false;
}

SbLogRaw

Description

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.

Declaration and definitions

SB_EXPORT void SbLogRaw(const char* message);

#include "starboard/log.h"

void SbLogRaw(const char* /*message*/) {
}

Parameters

Parameters
const char*
message
The message to be logged.

SbLogRawDumpStack

Description

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.

Declaration and definitions

SB_EXPORT void SbLogRawDumpStack(int frames_to_skip);

#include "starboard/log.h"

void SbLogRawDumpStack(int /*frames_to_skip*/) {
}

Parameters

Parameters
int
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.

SbLogRawFormat

Description

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 and definitions

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

#include "starboard/log.h"

void SbLogRawFormat(const char* /*format*/, va_list /*arguments*/) {
}

Parameters

Parameters
const char*
format
va_list
args

SbLogRawFormatF

Description

Inline wrapper of SbLogFormat to convert from ellipsis to va_args.

Declaration

static SB_C_INLINE void SbLogRawFormatF(const char* format, ...)
    SB_PRINTF_FORMAT(1, 2);
void SbLogRawFormatF(const char* format, ...) {
  va_list args;
  va_start(args, format);
  SbLogRawFormat(format, args);
  va_end(args);
}

Parameters

Parameters
const char*
format

...

SetMinLogLevel

Declaration

SB_EXPORT void SetMinLogLevel(SbLogPriority level);

Parameters

Parameters
SbLogPriority
level