ACF $AcfVersion:0$
Public Member Functions | List of all members
ilog::ILoggable Class Referenceabstract

Interface for objects that support logging functionality. More...

#include <ILoggable.h>

Inheritance diagram for ilog::ILoggable:
istd::IPolymorphic ilog::CLoggerBase ilog::TLoggerCompWrap< CFileTypeInfoComp > ilog::TLoggerCompWrap< ifile::CRelativeFileNameParamComp > ilog::TLoggerCompWrap< Base > ifile::CFileSerializerCompBase ifile::CGeneratedFileNameParamComp ibase::CConsoleApplicationComp idoc::CMultiPageDocumentFilePersistenceComp ifile::CAutoPersistenceComp ifile::CFileListProviderComp ifile::CFileSystemInfoProviderComp ifile::TDeviceBasedSerializerComp< ReadArchive, WriteArchive > ifilegui::CFileDialogLoaderComp iimg::CBitmapLoaderComp ipackage::CPackagesLoaderComp ipackage::CRegistriesManagerComp ipackage::CRegistryCodeSaverComp iqt::CClipboardSerializerComp iqt::CSettingsSerializerComp iqt::CTranslationManagerComp iqtgui::CProcessStartCommandComp

Public Member Functions

virtual void SetLogPtr (IMessageConsumer *logPtr)=0
 Attach a message consumer for logging.
 
virtual IMessageConsumerGetLogPtr () const =0
 Get the currently attached message consumer.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Detailed Description

Interface for objects that support logging functionality.

This interface allows objects to have a message consumer (logger) attached and detached. It's typically used in conjunction with CLoggerBase to provide logging capability to components and other objects.

Objects implementing this interface can accept a message consumer and use it to send log messages. The interface doesn't specify how messages are sent; that's typically handled by derived classes like CLoggerBase.

Usage Example
class MyClass : public ilog::ILoggable, public ilog::CLoggerBase
{
public:
void DoWork() {
if (GetLogPtr()) {
SendInfoMessage(1, "Starting work", "MyClass::DoWork");
}
}
};
// Usage
MyClass obj;
obj.SetLogPtr(log.get());
obj.DoWork(); // Will send log message
Base class for objects that need logging functionality.
Definition CLoggerBase.h:91
Interface for objects that support logging functionality.
Definition ILoggable.h:47
InterfaceType * get() noexcept
Shared ownership smart pointer for interface types.
See also
ilog::CLoggerBase, ilog::IMessageConsumer

Definition at line 46 of file ILoggable.h.

Member Function Documentation

◆ GetLogPtr()

virtual IMessageConsumer * ilog::ILoggable::GetLogPtr ( ) const
pure virtual

Get the currently attached message consumer.

Returns the message consumer previously set via SetLogPtr(), or NULL if no consumer is attached or if it was detached.

Returns
Pointer to the attached message consumer, or NULL if none attached.
Note
The returned pointer is not reference-counted. Don't store it; use it immediately and discard.
Example
IMessageConsumer* log = obj->GetLogPtr();
if (log) {
// Logger is attached, can send messages
}
else {
// No logger, skip logging
}
Common interface for a message container consuming information objects (messages).
See also
SetLogPtr()

Implemented in ilog::CLoggerBase.

◆ SetLogPtr()

virtual void ilog::ILoggable::SetLogPtr ( IMessageConsumer logPtr)
pure virtual

Attach a message consumer for logging.

Sets the message consumer that will receive log messages from this object. Pass NULL to detach the current logger and disable logging.

Parameters
logPtrPointer to message consumer to use for logging, or NULL to disable. The caller retains ownership of the consumer; this object only stores a weak pointer.
Note
This method doesn't perform reference counting. The caller must ensure the consumer remains valid while attached, or call SetLogPtr(NULL) before destroying the consumer.
Example
obj->SetLogPtr(console.get()); // Attach console logger
// ... use object with logging ...
obj->SetLogPtr(NULL); // Detach logger
Console logging component with colored output.
#define NULL
Definition istd.h:74
See also
GetLogPtr()

Implemented in ilog::CLoggerBase.


The documentation for this class was generated from the following file: