omni::log::ILogMessageConsumer

Defined in omni/log/ILog.h

class ILogMessageConsumer : public omni::core::Generated<omni::log::ILogMessageConsumer_abi>

Consumes (listens for) log messages.

omni::log::ILogMessageConsumer is usually associated with an omni::log::ILog instance. Add a consumer to an omni::log::ILog object with omni::log::ILog::addMessageConsumer().

Public Functions

inline void onMessage(const char *channel, omni::log::Level level, const char *moduleName, const char *fileName, const char *functionName, uint32_t lineNumber, const char *msg, carb::thread::ProcessId pid, carb::thread::ThreadId tid, uint64_t timestamp) noexcept

Receives a log message.

Logging a message from this method results in undefined behavior.

Accessing the owning omni::log::ILog from this method will lead to undefined behavior.

The memory pointed to by the provided pointers will remain valid only during the duration of this call.

Thread Safety

This method must be thread safe as the attached omni::log::ILog may send messages to this object in parallel.

inline void *cast(omni::core::TypeId id) noexcept

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void acquire() noexcept

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

Protected Functions

virtual void onMessage_abi(const char *channel, Level level, const char *moduleName, const char *fileName, const char *functionName, uint32_t lineNumber, const char *msg, carb::thread::ProcessId pid, carb::thread::ThreadId tid, uint64_t timestamp) noexcept = 0

Receives a log message.

Logging a message from this method results in undefined behavior.

Accessing the owning omni::log::ILog from this method will lead to undefined behavior.

The memory pointed to by the provided pointers will remain valid only during the duration of this call.

Thread Safety

This method must be thread safe as the attached omni::log::ILog may send messages to this object in parallel.

virtual void *cast_abi(TypeId id) noexcept = 0

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

virtual void acquire_abi() noexcept = 0

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

virtual void release_abi() noexcept = 0

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.