Assimp v5.2.2 (January 2022)
The Asset-Importer-Lib API documentation.
Assimp::Logger Class Referenceabstract

CPP-API: Abstract interface for logger implementations. More...

#include <Logger.hpp>

Inherits Intern::AllocateFromAssimpHeap.

Inherited by Assimp::DefaultLogger, and Assimp::NullLogger.

Public Types

enum  ErrorSeverity { Debugging = 1 , Info = 2 , Warn = 4 , Err = 8 }
 Description for severity of a log message. More...
 
enum  LogSeverity { NORMAL , DEBUGGING , VERBOSE }
 Log severity to describe the granularity of logging. More...
 

Public Member Functions

virtual bool attachStream (LogStream *pStream, unsigned int severity=Debugging|Err|Warn|Info)=0
 Attach a new log-stream. More...
 
void debug (const char *message)
 Writes a debug message. More...
 
template<typename... T>
void debug (T &&... args)
 
virtual bool detachStream (LogStream *pStream, unsigned int severity=Debugging|Err|Warn|Info)=0
 Detach a still attached stream from the logger (or modify the filter flags bits) More...
 
void error (const char *message)
 Writes an error message. More...
 
template<typename... T>
void error (T &&... args)
 
LogSeverity getLogSeverity () const
 Get the current log severity. More...
 
void info (const char *message)
 Writes a info message. More...
 
template<typename... T>
void info (T &&... args)
 
void setLogSeverity (LogSeverity log_severity)
 Set a new log severity. More...
 
void verboseDebug (const char *message)
 Writes a debug message. More...
 
template<typename... T>
void verboseDebug (T &&... args)
 
void warn (const char *message)
 Writes a warning message. More...
 
template<typename... T>
void warn (T &&... args)
 
virtual ~Logger ()
 Virtual destructor. More...
 

Protected Member Functions

std::string formatMessage (Assimp::Formatter::format f)
 
template<typename... T, typename U >
std::string formatMessage (Assimp::Formatter::format f, U &&u, T &&... args)
 
 Logger () AI_NO_EXCEPT
 Default constructor. More...
 
 Logger (LogSeverity severity)
 Construction with a given log severity. More...
 
virtual void OnDebug (const char *message)=0
 Called as a request to write a specific debug message. More...
 
virtual void OnError (const char *message)=0
 Called as a request to write a specific error message. More...
 
virtual void OnInfo (const char *message)=0
 Called as a request to write a specific info message. More...
 
virtual void OnVerboseDebug (const char *message)=0
 Called as a request to write a specific verbose debug message. More...
 
virtual void OnWarn (const char *essage)=0
 Called as a request to write a specific warn message. More...
 

Protected Attributes

LogSeverity m_Severity
 

Detailed Description

CPP-API: Abstract interface for logger implementations.

Assimp provides a default implementation and uses it for almost all logging stuff ('DefaultLogger'). This class defines just basic logging behavior and is not of interest for you. Instead, take a look at #DefaultLogger.

Member Enumeration Documentation

◆ ErrorSeverity

Description for severity of a log message.

Every LogStream has a bitwise combination of these flags. A LogStream doesn't receive any messages of a specific type if it doesn't specify the corresponding ErrorSeverity flag.

Enumerator
Debugging 

Debug log message.

Info 

Info log message.

Warn 

Warn log message.

Err 

Error log message.

◆ LogSeverity

Log severity to describe the granularity of logging.

Enumerator
NORMAL 

Normal granularity of logging.

DEBUGGING 

Debug messages will be logged, but not verbose debug messages.

VERBOSE 

All messages will be logged.

Constructor & Destructor Documentation

◆ ~Logger()

Assimp::Logger::~Logger ( )
inlinevirtualdefault

Virtual destructor.

◆ Logger() [1/2]

Assimp::Logger::Logger ( )
inlineprotected

Default constructor.

◆ Logger() [2/2]

Assimp::Logger::Logger ( LogSeverity  severity)
inlineexplicitprotected

Construction with a given log severity.

Member Function Documentation

◆ attachStream()

virtual bool Assimp::Logger::attachStream ( LogStream pStream,
unsigned int  severity = Debugging|Err|Warn|Info 
)
pure 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.

Parameters
pStreamLog-stream to attach
severityMessage filter, specified which types of log messages are dispatched to the stream. Provide a bitwise combination of the ErrorSeverity flags.
Returns
true if the stream has been attached, false otherwise.

Implemented in Assimp::NullLogger, and Assimp::DefaultLogger.

◆ debug() [1/2]

void Assimp::Logger::debug ( const char *  message)

Writes a debug message.

Parameters
messageDebug message

◆ debug() [2/2]

template<typename... T>
void Assimp::Logger::debug ( T &&...  args)
inline

◆ detachStream()

virtual bool Assimp::Logger::detachStream ( LogStream pStream,
unsigned int  severity = Debugging|Err|Warn|Info 
)
pure virtual

Detach a still attached stream from the logger (or modify the filter flags bits)

Parameters
pStreamLog-stream instance for detaching
severityProvide 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.
Returns
true if the stream has been detached, false otherwise.

Implemented in Assimp::NullLogger, and Assimp::DefaultLogger.

◆ error() [1/2]

void Assimp::Logger::error ( const char *  message)

Writes an error message.

Parameters
messageError message

◆ error() [2/2]

template<typename... T>
void Assimp::Logger::error ( T &&...  args)
inline

◆ formatMessage() [1/2]

std::string Assimp::Logger::formatMessage ( Assimp::Formatter::format  f)
inlineprotected

◆ formatMessage() [2/2]

template<typename... T, typename U >
std::string Assimp::Logger::formatMessage ( Assimp::Formatter::format  f,
U &&  u,
T &&...  args 
)
inlineprotected

◆ getLogSeverity()

Logger::LogSeverity Assimp::Logger::getLogSeverity ( ) const
inline

Get the current log severity.

◆ info() [1/2]

void Assimp::Logger::info ( const char *  message)

Writes a info message.

Parameters
messageInfo message

◆ info() [2/2]

template<typename... T>
void Assimp::Logger::info ( T &&...  args)
inline

◆ OnDebug()

virtual void Assimp::Logger::OnDebug ( const char *  message)
protectedpure virtual

Called as a request to write a specific debug message.

Parameters
messageDebug message. Never longer than MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').
Note
The message string is only valid until the scope of the function is left.

Implemented in Assimp::NullLogger.

◆ OnError()

virtual void Assimp::Logger::OnError ( const char *  message)
protectedpure virtual

Called as a request to write a specific error message.

Parameters
messageError message. Never longer than MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
Note
The message string is only valid until the scope of the function is left.

Implemented in Assimp::NullLogger.

◆ OnInfo()

virtual void Assimp::Logger::OnInfo ( const char *  message)
protectedpure virtual

Called as a request to write a specific info message.

Parameters
messageInfo message. Never longer than MAX_LOG_MESSAGE_LENGTH characters (ecxluding the '0').
Note
The message string is only valid until the scope of the function is left.

Implemented in Assimp::NullLogger.

◆ OnVerboseDebug()

virtual void Assimp::Logger::OnVerboseDebug ( const char *  message)
protectedpure virtual

Called as a request to write a specific verbose debug message.

Parameters
messageDebug message. Never longer than MAX_LOG_MESSAGE_LENGTH characters (excluding the '0').
Note
The message string is only valid until the scope of the function is left.

Implemented in Assimp::NullLogger.

◆ OnWarn()

virtual void Assimp::Logger::OnWarn ( const char *  essage)
protectedpure virtual

Called as a request to write a specific warn message.

Parameters
messageWarn message. Never longer than MAX_LOG_MESSAGE_LENGTH characters (exluding the '0').
Note
The message string is only valid until the scope of the function is left.

Implemented in Assimp::NullLogger.

◆ setLogSeverity()

void Assimp::Logger::setLogSeverity ( LogSeverity  log_severity)
inline

Set a new log severity.

Parameters
log_severityNew severity for logging

◆ verboseDebug() [1/2]

void Assimp::Logger::verboseDebug ( const char *  message)

Writes a debug message.

Parameters
messageDebug message

◆ verboseDebug() [2/2]

template<typename... T>
void Assimp::Logger::verboseDebug ( T &&...  args)
inline

◆ warn() [1/2]

void Assimp::Logger::warn ( const char *  message)

Writes a warning message.

Parameters
messageWarn message

◆ warn() [2/2]

template<typename... T>
void Assimp::Logger::warn ( T &&...  args)
inline

Member Data Documentation

◆ m_Severity

LogSeverity Assimp::Logger::m_Severity
protected

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