|
TrueReality
v0.1.1912
|
Manager for logs. More...
#include <LogManager.h>


Public Member Functions | |
| LogManager () | |
| Default constructor. More... | |
| ~LogManager () | |
| Destructor. More... | |
| bool | AddInstance (const std::string &name, Log *log) |
| Stores a new Log instance in the manager. More... | |
| Log * | GetInstance (const std::string &name) |
| Retrieves a stored Log instance. More... | |
| void | SetAllLogLevels (const LogLevel &newLevel) |
| Set the Log Level for all active Loggers. More... | |
| void | SetAllOutputStreamBits (unsigned int option) |
| Set the OutputStreamOptions bits for all stored Loggers The bits correspond to: NO_OUTPUT = 0x00000000, /// Log messages don't get written to any device TO_FILE = 0x00000001, /// Log messages get sent to the output file TO_CONSOLE = 0x00000002,/// Log messages get sent to the console TO_WRITER = 0x00000004,/// Log messages get sent to all registered writers STANDARD = TO_FILE | TO_CONSOLE | TO_WRITER /// The default setting. More... | |
| bool | IsLogTimeProviderValid () const |
| Check if the Log Time Provider is currently valid in this manager. More... | |
| void | ReOpenFile () |
| Reopens the log file. More... | |
| void | LogHorizRule () |
| Writes out a horizontal line to the Log File. More... | |
| void | LogMessageToFile (const LogWriter::LogData &logData) |
| Write out a message to the Log file. More... | |
| void | LogMessageToConsole (const LogWriter::LogData &logData) |
| Write out a message to the screen console. More... | |
| void | SetLogTimeProvider (LogTimeProvider *ltp) |
| This sets a Log time source. More... | |
| unsigned int | GetFrameNumber () |
| Returns the stored frame number. More... | |
| const trUtil::DateTime & | GetDateTime () |
| Returns the reference to the stored DateTime object. More... | |
| OpenThreads::Mutex & | GetMutex () |
| Returns the reference to an internal OpenThreads Mutex. More... | |
Private Attributes | |
| trUtil::HashMap< std::string, osg::ref_ptr< Log > > | mInstances |
| osg::ref_ptr< LogWriter > | mLogWriterConsole |
| osg::ref_ptr< LogWriterFile > | mLogWriterFile |
| writes to console More... | |
| osg::observer_ptr< osg::Referenced > | mLogTimeProviderAsRef |
| writes to file More... | |
| LogTimeProvider * | mLogTimeProvider |
| OpenThreads::Mutex | mMutex |
Manager for logs.
Definition at line 56 of file LogManager.h.
| trUtil::Logging::LogManager::LogManager | ( | ) |
Default constructor.
Definition at line 35 of file LogManager.cpp.
| trUtil::Logging::LogManager::~LogManager | ( | ) |
Destructor.
Definition at line 43 of file LogManager.cpp.
References mInstances, mLogWriterConsole, and mLogWriterFile.
| bool trUtil::Logging::LogManager::AddInstance | ( | const std::string & | name, |
| Log * | log | ||
| ) |
Stores a new Log instance in the manager.
| name | The name. | |
| [in,out] | log | If non-null, the log. |
Definition at line 51 of file LogManager.cpp.
References mInstances.
| const trUtil::DateTime & trUtil::Logging::LogManager::GetDateTime | ( | ) |
Returns the reference to the stored DateTime object.
Definition at line 139 of file LogManager.cpp.
References trUtil::Logging::LogTimeProvider::GetDateTime(), and mLogTimeProvider.

| unsigned int trUtil::Logging::LogManager::GetFrameNumber | ( | void | ) |
Returns the stored frame number.
Definition at line 133 of file LogManager.cpp.
References trUtil::Logging::LogTimeProvider::GetFrameNumber(), and mLogTimeProvider.

| Log * trUtil::Logging::LogManager::GetInstance | ( | const std::string & | name | ) |
Retrieves a stored Log instance.
| name | - name of the Log to retrieve. |
Definition at line 57 of file LogManager.cpp.
References mInstances.
| OpenThreads::Mutex & trUtil::Logging::LogManager::GetMutex | ( | ) |
Returns the reference to an internal OpenThreads Mutex.
Definition at line 145 of file LogManager.cpp.
References mMutex.
| bool trUtil::Logging::LogManager::IsLogTimeProviderValid | ( | ) | const |
Check if the Log Time Provider is currently valid in this manager.
Definition at line 88 of file LogManager.cpp.
References mLogTimeProvider, and mLogTimeProviderAsRef.
| void trUtil::Logging::LogManager::LogHorizRule | ( | ) |
Writes out a horizontal line to the Log File.
Definition at line 101 of file LogManager.cpp.
References mLogWriterFile.
| void trUtil::Logging::LogManager::LogMessageToConsole | ( | const LogWriter::LogData & | logData | ) |
Write out a message to the screen console.
| logData | Information describing the log. |
Definition at line 113 of file LogManager.cpp.
References mLogWriterConsole.
| void trUtil::Logging::LogManager::LogMessageToFile | ( | const LogWriter::LogData & | logData | ) |
Write out a message to the Log file.
| logData | Information describing the log. |
Definition at line 107 of file LogManager.cpp.
References mLogWriterFile.
| void trUtil::Logging::LogManager::ReOpenFile | ( | ) |
Reopens the log file.
This is used if a file failed to open, or file name has changed.
Definition at line 94 of file LogManager.cpp.
References mLogWriterFile.
Referenced by trUtil::Logging::LogFile::SetFileName().

| void trUtil::Logging::LogManager::SetAllLogLevels | ( | const LogLevel & | newLevel | ) |
Set the Log Level for all active Loggers.
| newLevel | The new level. |
Definition at line 68 of file LogManager.cpp.
References mInstances, and trUtil::Logging::Log::SetLogLevel().

| void trUtil::Logging::LogManager::SetAllOutputStreamBits | ( | unsigned int | option | ) |
Set the OutputStreamOptions bits for all stored Loggers The bits correspond to: NO_OUTPUT = 0x00000000, /// Log messages don't get written to any device TO_FILE = 0x00000001, /// Log messages get sent to the output file TO_CONSOLE = 0x00000002,/// Log messages get sent to the console TO_WRITER = 0x00000004,/// Log messages get sent to all registered writers STANDARD = TO_FILE | TO_CONSOLE | TO_WRITER /// The default setting.
| option | The option. |
Definition at line 78 of file LogManager.cpp.
References mInstances, and trUtil::Logging::Log::SetOutputStreamBit().

| void trUtil::Logging::LogManager::SetLogTimeProvider | ( | LogTimeProvider * | ltp | ) |
This sets a Log time source.
This allows another part of the system to update and provide both a time and a frame number, as needed. Otherwise, the time will be set on the log data every time log is called.
| [in,out] | ltp | If non-null, the ltp. |
Definition at line 119 of file LogManager.cpp.
References trUtil::Logging::LogTimeProvider::AsReferenced(), mLogTimeProvider, and mLogTimeProviderAsRef.

|
private |
Definition at line 200 of file LogManager.h.
Referenced by AddInstance(), GetInstance(), SetAllLogLevels(), SetAllOutputStreamBits(), and ~LogManager().
|
private |
Definition at line 205 of file LogManager.h.
Referenced by GetDateTime(), GetFrameNumber(), IsLogTimeProviderValid(), and SetLogTimeProvider().
|
private |
writes to file
Definition at line 204 of file LogManager.h.
Referenced by IsLogTimeProviderValid(), and SetLogTimeProvider().
|
private |
Definition at line 202 of file LogManager.h.
Referenced by LogMessageToConsole(), and ~LogManager().
|
private |
writes to console
Definition at line 203 of file LogManager.h.
Referenced by LogHorizRule(), LogMessageToFile(), ReOpenFile(), and ~LogManager().
|
private |
Definition at line 206 of file LogManager.h.
Referenced by GetMutex().