Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Logger Class Reference

Responsible for processing log messages. More...

#include <mitsuba/mitsuba.h>

+ Inheritance diagram for mitsuba::Logger:

Public Member Functions

 Logger (ELogLevel logLevel=EDebug)
 Construct a new logger with the given minimum log level. More...
 
void log (ELogLevel level, const Class *theClass, const char *fileName, int lineNumber, const char *fmt,...)
 Process a log message. More...
 
void logProgress (Float progress, const std::string &name, const std::string &formatted, const std::string &eta, const void *ptr)
 Process a progress message. More...
 
void setLogLevel (ELogLevel level)
 Set the log level (everything below will be ignored) More...
 
void setErrorLevel (ELogLevel level)
 Set the error log level (this level and anything above will throw exceptions). More...
 
ELogLevel getLogLevel () const
 Return the current log level. More...
 
ELogLevel getErrorLevel () const
 Return the current error level. More...
 
void addAppender (Appender *appender)
 Add an appender to this logger. More...
 
void removeAppender (Appender *appender)
 Remove an appender from this logger. More...
 
void clearAppenders ()
 Remove all appenders from this logger. More...
 
size_t getAppenderCount () const
 Return the number of registered appenders. More...
 
AppendergetAppender (size_t index)
 Return one of the appenders. More...
 
const AppendergetAppender (size_t index) const
 Return one of the appenders. More...
 
void setFormatter (Formatter *formatter)
 Set the logger's formatter implementation. More...
 
FormattergetFormatter ()
 Return the logger's formatter implementation. More...
 
bool readLog (std::string &target)
 Return the contents of the log file as a string (if it exists) More...
 
size_t getWarningCount () const
 Return the number of warnings reported so far. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Member Functions

static void staticInitialization ()
 Initialize logging. More...
 
static void staticShutdown ()
 Shutdown logging. More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~Logger ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Friends

class Statistics
 

Detailed Description

Responsible for processing log messages.

Upon receiving a log message, the Logger class invokes a Formatter to convert it into a human-readable form. Following that, it sends this information to every registered Appender.

Constructor & Destructor Documentation

mitsuba::Logger::Logger ( ELogLevel  logLevel = EDebug)

Construct a new logger with the given minimum log level.

virtual mitsuba::Logger::~Logger ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

void mitsuba::Logger::addAppender ( Appender appender)

Add an appender to this logger.

void mitsuba::Logger::clearAppenders ( )

Remove all appenders from this logger.

Appender* mitsuba::Logger::getAppender ( size_t  index)
inline

Return one of the appenders.

const Appender* mitsuba::Logger::getAppender ( size_t  index) const
inline

Return one of the appenders.

size_t mitsuba::Logger::getAppenderCount ( ) const
inline

Return the number of registered appenders.

virtual const Class* mitsuba::Logger::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

ELogLevel mitsuba::Logger::getErrorLevel ( ) const
inline

Return the current error level.

Formatter* mitsuba::Logger::getFormatter ( )
inline

Return the logger's formatter implementation.

ELogLevel mitsuba::Logger::getLogLevel ( ) const
inline

Return the current log level.

size_t mitsuba::Logger::getWarningCount ( ) const
inline

Return the number of warnings reported so far.

void mitsuba::Logger::log ( ELogLevel  level,
const Class theClass,
const char *  fileName,
int  lineNumber,
const char *  fmt,
  ... 
)

Process a log message.

Parameters
levelLog level of the message
theClassClass descriptor of the message creator
fileNameSource file of the message creator
lineNumberSource line number of the message creator
fmtprintf-style string formatter
Note
This function is not exposed in the Python bindings. Instead, please use mitsuba.core.Log
void mitsuba::Logger::logProgress ( Float  progress,
const std::string &  name,
const std::string &  formatted,
const std::string &  eta,
const void *  ptr 
)

Process a progress message.

Parameters
progressPercentage value in [0,100]
nameTitle of the progress message
formattedFormatted string representation of the message
etaEstimated time until 100% is reached.
ptrCustom pointer payload. This is used to express the context of a progress message. When rendering a scene, it will usually contain a pointer to the associated RenderJob.
Remarks
The ptr argument is missing in the Python bindings
bool mitsuba::Logger::readLog ( std::string &  target)

Return the contents of the log file as a string (if it exists)

Returns
true upon success
void mitsuba::Logger::removeAppender ( Appender appender)

Remove an appender from this logger.

void mitsuba::Logger::setErrorLevel ( ELogLevel  level)

Set the error log level (this level and anything above will throw exceptions).

The value provided here can be used for instance to turn warnings into errors. But level must always be less than EError, i.e. it isn't possible to cause errors not to throw an exception.

void mitsuba::Logger::setFormatter ( Formatter formatter)

Set the logger's formatter implementation.

void mitsuba::Logger::setLogLevel ( ELogLevel  level)

Set the log level (everything below will be ignored)

static void mitsuba::Logger::staticInitialization ( )
static

Initialize logging.

static void mitsuba::Logger::staticShutdown ( )
static

Shutdown logging.

Friends And Related Function Documentation

friend class Statistics
friend

Member Data Documentation

Class* mitsuba::Logger::m_theClass
static

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