# 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:

List of all members.

## Public Member Functions

| LogManager ()
| ~LogManager ()
void | addListener (LogListener *listener)
| Adds a new listener for the logging system.
void | removeListener (LogListener *listener)
| Removes a previously registered listener again, and returns ownership of the listener to the caller, who is responsible for destroying the listener again.
Log * | createLog (const String &name, bool defaultLog=false, bool debuggerOutput=true, bool suppressFileOutput=false)
| Creates a new log with the given name.
Log * | getLog (const String &name)
| Retrieves a log managed by this class.
Log * | getDefaultLog ()
| Returns a pointer to the default log.
Log * | setDefaultLog (Log *newLog)
| Sets the passed in log as the default log.
void | logMessage (const String &message, LogMessageLevel lml=LML_NORMAL, bool maskDebug=false)
| Log a message to the default log.
void | logMessage (LogMessageLevel lml, const String &message, bool maskDebug=false)
| Log a message to the default log (signature for backward compatibility).
void | setLogDetail (LoggingLevel ll)
| Sets the level of detail of the default log.

## Static Public Member Functions

LogManager & | getSingleton (void)
| Override standard Singleton retrieval.
LogManager * | getSingletonPtr (void)
| Override standard Singleton retrieval.

## Protected Types

typedef std::map< String, Log *, std::less< String > > | LogList
typedef std::vector< LogListener * > | LogListenerList

## Protected Member Functions

void | _routeMessage (const String &name, const String &message, LogMessageLevel lml=LML_NORMAL, bool maskDebug=false)
| Internal helper method to reroute logging messages to the new listener system, while maintaining full backward compatiblity.

## Protected Attributes

LogList | mLogs
| A list of all the logs the manager can access.
Log * | mDefaultLog
| The default log to which output is done.
LogListenerList | mListeners
| A list of all registered external log listeners.

## Static Protected Attributes

LogManager * | ms_Singleton

## Friends

class | Log

## 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.

Definition at line 62 of file OgreLogManager.h.

## Member Typedef Documentation

typedef std::map<String, Log*, std::less<String> > Ogre::LogManager::LogList `[protected]`

| Definition at line 76 of file OgreLogManager.h.

typedef std::vector<LogListener*> Ogre::LogManager::LogListenerList `[protected]`

| Definition at line 77 of file OgreLogManager.h.

## Constructor & Destructor Documentation

Ogre::LogManager::LogManager | ( |  | ) |

Ogre::LogManager::~LogManager | ( |  | ) |

## Member Function Documentation

void Ogre::LogManager::_routeMessage | ( | const String & | name,
|  | const String & | message,
|  | LogMessageLevel | lml = LML_NORMAL,
|  | bool | maskDebug = false
| ) | `[protected]`

| Internal helper method to reroute logging messages to the new listener system, while maintaining full backward compatiblity.

void Ogre::LogManager::addListener | ( | LogListener * | listener | ) |

| Adds a new listener for the logging system. Ogre does not assume ownership and does not destroy the listener at application shutdown.

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:

  name | The name to give the log e.g. 'Ogre.log'
  defaultLog | If 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.
  debuggerOutput | If true, output to this log will also be routed to the debugger's output window.
  suppressFileOutput | If 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.

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.

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.

Reimplemented from Ogre::Singleton< LogManager >.

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.

Reimplemented from Ogre::Singleton< LogManager >.

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

| Log a message to the default log (signature for backward compatibility). Definition at line 143 of file OgreLogManager.h. References Ogre::String.

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

| Log a message to the default log.

void Ogre::LogManager::removeListener | ( | LogListener * | listener | ) |

| Removes a previously registered listener again, and returns ownership of the listener to the caller, who is responsible for destroying the listener again.

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.

## Friends And Related Function Documentation

friend class Log `[friend]`

| Definition at line 64 of file OgreLogManager.h.

## Member Data Documentation

Log* Ogre::LogManager::mDefaultLog `[protected]`

| The default log to which output is done. Definition at line 83 of file OgreLogManager.h.

LogListenerList Ogre::LogManager::mListeners `[protected]`

| A list of all registered external log listeners. Definition at line 86 of file OgreLogManager.h.

LogList Ogre::LogManager::mLogs `[protected]`

| A list of all the logs the manager can access. Definition at line 80 of file OgreLogManager.h.

LogManager * Ogre::Singleton< LogManager >::ms_Singleton `[static, protected, inherited]`

| Definition at line 54 of file OgreSingleton.h.

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

- OgreLogManager.h

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:37:09 2005