Drag[en]gine Game Engine  1.0
deLoggerFile Class Reference

Logs to file. More...

#include <deLoggerFile.h>

Inheritance diagram for deLoggerFile:
deLogger deObject

Public Member Functions

Management
decBaseFileWriterGetWriter () const
 File writer. More...
 
virtual void LogInfo (const char *source, const char *message)
 Log information message. More...
 
virtual void LogWarn (const char *source, const char *message)
 Log warning message. More...
 
virtual void LogError (const char *source, const char *message)
 Log error message. More...
 
- Public Member Functions inherited from deLogger
virtual void LogInfoFormat (const char *source, const char *message,...)
 Log formatted information message. More...
 
virtual void LogInfoFormatUsing (const char *source, const char *message, va_list args)
 Log formatted information message. More...
 
virtual void LogWarnFormat (const char *source, const char *message,...)
 Log formated warning message. More...
 
virtual void LogWarnFormatUsing (const char *source, const char *message, va_list args)
 Log formated warning message. More...
 
virtual void LogErrorFormat (const char *source, const char *message,...)
 Log formated error message. More...
 
virtual void LogErrorFormatUsing (const char *source, const char *message, va_list args)
 Log formated error message. More...
 
virtual void LogException (const char *source, const deException &exception)
 Log exception error message. More...
 
 deLogger ()
 Creates logger. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Protected Member Functions

deMutexGetMutex ()
 
- Protected Member Functions inherited from deLogger
virtual ~deLogger ()
 Clean up logger. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Constructors and Destructors

 deLoggerFile (decBaseFileWriter *writer)
 Create file logger. More...
 
virtual ~deLoggerFile ()
 Clean up file logger. More...
 

Detailed Description

Logs to file.

Adds a prefix depending on the log message type. The file is given by a file writer. The file writer object is owned by the file logger. It is therefore deleted when the file logger is freed.

Note
Logger console is thread safe. To avoid torn logs the entire text line is formated in memory and send as one write call then fflush is called. Be careful with the use of the file writer outside the logger. deObject reference counting is not thread safe.

Constructor & Destructor Documentation

◆ deLoggerFile()

deLoggerFile::deLoggerFile ( decBaseFileWriter writer)

Create file logger.

◆ ~deLoggerFile()

virtual deLoggerFile::~deLoggerFile ( )
protectedvirtual

Clean up file logger.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ GetMutex()

deMutex& deLoggerFile::GetMutex ( )
inlineprotected

◆ GetWriter()

decBaseFileWriter* deLoggerFile::GetWriter ( ) const
inline

File writer.

References LogError(), LogInfo(), and LogWarn().

◆ LogError()

virtual void deLoggerFile::LogError ( const char *  source,
const char *  message 
)
virtual

Log error message.

Reimplemented from deLogger.

Referenced by GetWriter().

◆ LogInfo()

virtual void deLoggerFile::LogInfo ( const char *  source,
const char *  message 
)
virtual

Log information message.

Reimplemented from deLogger.

Referenced by GetWriter().

◆ LogWarn()

virtual void deLoggerFile::LogWarn ( const char *  source,
const char *  message 
)
virtual

Log warning message.

Reimplemented from deLogger.

Referenced by GetWriter().


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