OMNI_LOG_WRITE
Defined in omni/log/ILog.h
-
OMNI_LOG_WRITE(channelOrFormat_, level_, ...)
Logs a message.
The first argument can be either a channel or the format string.
The second argument must be omni::log::Level at which to log the message.
If the first argument is a channel, the third argument is the format string. Channels can be created with the OMNI_LOG_ADD_CHANNEL macro.
For example:
OMNI_LOG_ADD_CHANNEL(kImageLoadChannel, "omni.image.load", "Messages when loading an image."); ... OMNI_LOG_WRITE(kImageLoadChannel, omni::log::Level::eVerbose, "I loaded a cool image: %s", imageFilename);
If the first argument is the format string, the channel defined by the OMNI_LOG_DEFAULT_CHANNEL is used. Example usage:
OMNI_LOG_WRITE("This message is going to the default channel: %s", omni::log::Level::eInfo, "woo-hoo");
The given format string uses the same tokens as the
printf
family of functions.The omni::log::ILog used to log the message is the log returned by omniGetLogWithoutAcquire().
Rather than using this function, consider using OMNI_LOG_VERBOSE, OMNI_LOG_INFO, OMNI_LOG_WARN, OMNI_LOG_ERROR, OMNI_LOG_FATAL.
- Thread Safety
This macro is thread safe though may block if
omniGetLogWithAcquire()->isAsync()
isfalse
. Implementation detail. Figure out if the first arg is a channel or a format string, check if the channel (or default channel) is enabled, and only then evaluate the given arguments and call into the logger.