Assimp
v2.0 (November 2010)
|
CPP-API: Primary logging facility of Assimp. More...
Inherits Assimp::Logger.
Public Member Functions | |
bool | attachStream (LogStream *pStream, unsigned int severity) |
bool | detatchStream (LogStream *pStream, unsigned int severity) |
Static Public Member Functions | |
static Logger * | create (const char *name=ASSIMP_DEFAULT_LOG_NAME, LogSeverity severity=NORMAL, unsigned int defStreams=aiDefaultLogStream_DEBUGGER|aiDefaultLogStream_FILE, IOSystem *io=NULL) |
Creates a logging instance. | |
static Logger * | get () |
Getter for singleton instance. | |
static bool | isNullLogger () |
Return whether a #NullLogger is currently active. | |
static void | kill () |
Kills the current singleton logger and replaces it with a #NullLogger instance. | |
static void | set (Logger *logger) |
Setup a custom Logger implementation. |
CPP-API: Primary logging facility of Assimp.
The library stores its primary Logger as a static member of this class. get() returns this primary logger. By default the underlying implementation is just a #NullLogger which rejects all log messages. By calling create(), logging is turned on. To capture the log output multiple log streams (#LogStream) can be attach to the logger. Some default streams for common streaming locations (such as a file, std::cout, OutputDebugString()) are also provided.
If you wish to customize the logging at an even deeper level supply your own implementation of Logger to set().
bool Assimp::DefaultLogger::attachStream | ( | LogStream * | pStream, |
unsigned int | severity | ||
) | [virtual] |
Attach a new log-stream.
The logger takes ownership of the stream and is responsible for its destruction (which is done using ::delete when the logger itself is destroyed). Call detachStream to detach a stream and to gain ownership of it again.
pStream | Log-stream to attach |
severity | Message filter, specified which types of log messages are dispatched to the stream. Provide a bitwise combination of the ErrorSeverity flags. |
Implements Assimp::Logger.
static Logger* Assimp::DefaultLogger::create | ( | const char * | name = ASSIMP_DEFAULT_LOG_NAME , |
LogSeverity | severity = NORMAL , |
||
unsigned int | defStreams = aiDefaultLogStream_DEBUGGER|aiDefaultLogStream_FILE , |
||
IOSystem * | io = NULL |
||
) | [static] |
Creates a logging instance.
name | Name for log file. Only valid in combination with the aiDefaultLogStream_FILE flag. |
severity | Log severity, VERBOSE turns on debug messages |
defStreams | Default log streams to be attached. Any bitwise combination of the aiDefaultLogStream enumerated values. If #aiDefaultLogStream_FILE is specified but an empty string is passed for 'name', no log file is created at all. |
io | IOSystem to be used to open external files (such as the log file). Pass NULL to rely on the default implementation. This replaces the default #NullLogger with a #DefaultLogger instance. |
bool Assimp::DefaultLogger::detatchStream | ( | LogStream * | pStream, |
unsigned int | severity | ||
) | [virtual] |
Detach a still attached stream from the logger (or modify the filter flags bits)
pStream | Log-stream instance for detaching |
severity | Provide a bitwise combination of the ErrorSeverity flags. This value is &~ed with the current flags of the stream, if the result is 0 the stream is detached from the Logger and the caller retakes the possession of the stream. |
Implements Assimp::Logger.
static Logger* Assimp::DefaultLogger::get | ( | ) | [static] |
Getter for singleton instance.
static bool Assimp::DefaultLogger::isNullLogger | ( | ) | [static] |
static void Assimp::DefaultLogger::kill | ( | ) | [static] |
Kills the current singleton logger and replaces it with a #NullLogger instance.
static void Assimp::DefaultLogger::set | ( | Logger * | logger | ) | [static] |
Setup a custom Logger implementation.
Use this if the provided #DefaultLogger class doesn't fit into your needs. If the provided message formatting is OK for you, it's much easier to use create() and to attach your own custom output streams to it.
logger | Pass NULL to setup a default NullLogger |