OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ogre::LogManager Class Reference

The log manager handles the creation and retrieval of logs for the application. More...

#include <OgreLogManager.h>

+ Inheritance diagram for Ogre::LogManager:
+ Collaboration diagram for Ogre::LogManager:

Public Member Functions

OGRE_AUTO_MUTEX LogManager ()
 
 ~LogManager ()
 
LogcreateLog (const String &name, bool defaultLog=false, bool debuggerOutput=true, bool suppressFileOutput=false)
 Creates a new log with the given name. More...
 
void destroyLog (const String &name)
 Closes and removes a named log. More...
 
void destroyLog (Log *log)
 Closes and removes a log. More...
 
LoggetDefaultLog ()
 Returns a pointer to the default log. More...
 
LoggetLog (const String &name)
 Retrieves a log managed by this class. More...
 
void logMessage (const String &message, LogMessageLevel lml=LML_NORMAL, bool maskDebug=false)
 Log a message to the default log. More...
 
void logMessage (LogMessageLevel lml, const String &message, bool maskDebug=false)
 Log a message to the default log (signature for backward compatibility). More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
LogsetDefaultLog (Log *newLog)
 Sets the passed in log as the default log. More...
 
void setLogDetail (LoggingLevel ll)
 Sets the level of detail of the default log. More...
 
Log::Stream stream (LogMessageLevel lml=LML_NORMAL, bool maskDebug=false)
 Get a stream on the default log. More...
 

Static Public Member Functions

static LogManagergetSingleton (void)
 Override standard Singleton retrieval. More...
 
static LogManagergetSingletonPtr (void)
 Override standard Singleton retrieval. More...
 

Protected Types

typedef map< String, Log * >::type LogList
 

Protected Attributes

LogmDefaultLog
 The default log to which output is done. More...
 
LogList mLogs
 A list of all the logs the manager can access. More...
 

Static Protected Attributes

static LogManagerms_Singleton
 

Detailed Description

The log manager handles the creation and retrieval of logs for the application.

Remarks
This class will create new log files and will retrieve instances of existing ones. Other classes wishing to log output can either create a fresh log or retrieve an existing one to output to. One log is the default log, and is the one written to when the logging methods of this class are called.
By default, Root will instantiate a LogManager (which becomes the Singleton instance) on construction, and will create a default log based on the Root construction parameters. If you want more control, for example redirecting log output right from the start or suppressing debug output, you need to create a LogManager yourself before creating a Root instance, then create a default log. Root will detect that you've created one yourself and won't create one of its own, thus using all your logging preferences from the first instance.

Definition at line 64 of file OgreLogManager.h.

Member Typedef Documentation

typedef map<String, Log*>::type Ogre::LogManager::LogList
protected

Definition at line 67 of file OgreLogManager.h.

Constructor & Destructor Documentation

OGRE_AUTO_MUTEX Ogre::LogManager::LogManager ( )
Ogre::LogManager::~LogManager ( )

Member Function Documentation

Log* Ogre::LogManager::createLog ( const String name,
bool  defaultLog = false,
bool  debuggerOutput = true,
bool  suppressFileOutput = false 
)

Creates a new log with the given name.

Parameters
nameThe name to give the log e.g. 'Ogre.log'
defaultLogIf true, this is the default log output will be sent to if the generic logging methods on this class are used. The first log created is always the default log unless this parameter is set.
debuggerOutputIf true, output to this log will also be routed to the debugger's output window.
suppressFileOutputIf true, this is a logical rather than a physical log and no file output will be written. If you do this you should register a LogListener so log output is not lost.
void Ogre::LogManager::destroyLog ( const String name)

Closes and removes a named log.

void Ogre::LogManager::destroyLog ( Log log)

Closes and removes a log.

Log* Ogre::LogManager::getDefaultLog ( )

Returns a pointer to the default log.

Log* Ogre::LogManager::getLog ( const String name)

Retrieves a log managed by this class.

static LogManager& Ogre::LogManager::getSingleton ( void  )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
static LogManager* Ogre::LogManager::getSingletonPtr ( void  )
static

Override standard Singleton retrieval.

Remarks
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.
void Ogre::LogManager::logMessage ( const String message,
LogMessageLevel  lml = LML_NORMAL,
bool  maskDebug = false 
)

Log a message to the default log.

void Ogre::LogManager::logMessage ( LogMessageLevel  lml,
const String message,
bool  maskDebug = false 
)
inline

Log a message to the default log (signature for backward compatibility).

Definition at line 125 of file OgreLogManager.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

Definition at line 90 of file OgreMemoryAllocatedObject.h.

Log* Ogre::LogManager::setDefaultLog ( Log newLog)

Sets the passed in log as the default log.

Returns
The previous default log.
void Ogre::LogManager::setLogDetail ( LoggingLevel  ll)

Sets the level of detail of the default log.

Log::Stream Ogre::LogManager::stream ( LogMessageLevel  lml = LML_NORMAL,
bool  maskDebug = false 
)

Get a stream on the default log.

Member Data Documentation

Log* Ogre::LogManager::mDefaultLog
protected

The default log to which output is done.

Definition at line 73 of file OgreLogManager.h.

LogList Ogre::LogManager::mLogs
protected

A list of all the logs the manager can access.

Definition at line 70 of file OgreLogManager.h.

LogManager * Ogre::Singleton< LogManager >::ms_Singleton
staticprotectedinherited

Definition at line 75 of file OgreSingleton.h.


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