Message Logging

Utilities to interact with the Omniverse logging system in a consistent manner across Connectors.

Use the omni::log API to emit messages, change the log level, disable channels, etc.

The following constants are defined for use in C++

kConnectCoreChannel : This is the main channel used by the Connect SDK
Example:
OMNI_LOG_WARN(kConnectCoreChannel, "This is a warning from the Connect SDK");

auto log = omniGetLogWithoutAcquire();
auto level = omni::log::Level::eVerbose;
log->setChannelLevel(kConnectCoreChannel, level, omni::log::SettingBehavior::eOverride);

Note

Client code should not use kConnectCoreChannel channel to emit messages. Create your own channel instead using OMNI_LOG_ADD_CHANNEL or OMNI_APP_GLOBALS.

Functions

void omni::connect::core::addLogConsumer(const std::string &name, ClientAppLogCallback callback)

Adds a log consumer.

void omni::connect::core::enableStandardOutputStream(bool enabled)

Enables and disables logging to the standard output stream.

const char * omni::connect::core::logChannel()

Get the main log channel name for the Connect SDK.

void omni::connect::core::removeLogConsumer(const std::string &name)

Removes a log consumer.

void omni::connect::core::startupLog()

Initialize the Omniverse logging system. This enables the logging system and forwards Omniverse Client Library messages to the Connect SDK channel.

Typedefs

omni::connect::core::ClientAppLogCallback

Callback for message consumers.

Functions

void omni::connect::core::addLogConsumer(const std::string &name, ClientAppLogCallback callback)

Adds a log consumer.

The provided callback will be hit when any log within the app’s set log level is published. Log level is set in the implementer’s omni.connect.client.toml file. If two consumers with the same name are added the first is removed automatically.

Parameters
  • name – The name of the consumer. No two log consumers can have the same name.

  • callback – The function to be called when a log is published.

void omni::connect::core::enableStandardOutputStream(bool enabled)

Enables and disables logging to the standard output stream.

This is a convenience around Carbonite’s ILogging.

Parameters

enabled – Determine if the output stream should be enabled or disabled

const char *omni::connect::core::logChannel()

Get the main log channel name for the Connect SDK.

This is a convenience wrapper around kConnectCoreChannel.name.

Returns

The main log channel name for the Connect SDK.

void omni::connect::core::removeLogConsumer(const std::string &name)

Removes a log consumer.

The callback will no longer be hit when a log is published.

Parameters

name – The name of the consumer to remove.

void omni::connect::core::startupLog()

Initialize the Omniverse logging system. This enables the logging system and forwards Omniverse Client Library messages to the Connect SDK channel.

Typedefs

typedef std::function<void(const char *channel, omni::log::Level level, const char *message)> omni::connect::core::ClientAppLogCallback

Callback for message consumers.

Pass a callback matching this form into omni::connect::core::addLogConsumer to receive carb logs.

Param channel

The channel of this log message.

Param level

The level of severity of this log message.

Param message

The contents of this log message.