FEATURE: Add interfaces for logger and logstream
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@2 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
b76f999cb7
commit
fe773845cb
|
@ -0,0 +1,42 @@
|
|||
#ifndef AI_LOGSTREAM_H_INC
|
||||
#define AI_LOGSTREAM_H_INC
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @class LogStream
|
||||
* @brief Abstract interface for log stream implementations.
|
||||
*/
|
||||
class LogStream
|
||||
{
|
||||
protected:
|
||||
/** @brief Default constructor */
|
||||
LogStream();
|
||||
|
||||
public:
|
||||
/** @brief Virtual destructor */
|
||||
virtual ~LogStream();
|
||||
|
||||
/** @brief Overwrite this for your own output methods */
|
||||
virtual void write(const std::string &message) = 0;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Default constructor
|
||||
inline LogStream::LogStream()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Virtual destructor
|
||||
inline LogStream::~LogStream()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
#endif
|
|
@ -0,0 +1,98 @@
|
|||
#ifndef AI_LOGGER_H_INC
|
||||
#define AI_LOGGER_H_INC
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
|
||||
class LogStream;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @class Logger
|
||||
* @brief Abstract interface for logger implementations.
|
||||
*/
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
/** @enum LogSeverity
|
||||
* @brief Log severity to descripe granuality of logging.
|
||||
*/
|
||||
enum LogSeverity
|
||||
{
|
||||
NORMAL, //!< Normal granlality of logging
|
||||
VERBOSE //!< Debug infos will be logged, too
|
||||
};
|
||||
|
||||
/** @enum ErrorSeverity
|
||||
* @brief Description for severity of a log message
|
||||
*/
|
||||
enum ErrorSeverity
|
||||
{
|
||||
DEBUGGING = 1, //!< Debug log message
|
||||
INFO = 2, //!< Info log message
|
||||
WARN = 4, //!< Warn log message
|
||||
ERR = 8 //!< Error log message
|
||||
};
|
||||
|
||||
public:
|
||||
/** @brief Virtual destructor */
|
||||
virtual ~Logger();
|
||||
|
||||
/** @brief Writes a debug message
|
||||
* @param message Debug message
|
||||
*/
|
||||
virtual void debug(const std::string &message)= 0;
|
||||
|
||||
/** @brief Writes a info message
|
||||
* @param message Info message
|
||||
*/
|
||||
virtual void info(const std::string &message) = 0;
|
||||
|
||||
/** @brief Writes a warning message
|
||||
* @param message Warn message
|
||||
*/
|
||||
virtual void warn(const std::string &message) = 0;
|
||||
|
||||
/** @brief Writes an error message
|
||||
* @param message Error message
|
||||
*/
|
||||
virtual void error(const std::string &message) = 0;
|
||||
|
||||
/** @brief Set a new log severity.
|
||||
* @param log_severity New severity for logging
|
||||
*/
|
||||
virtual void setLogSeverity(LogSeverity log_severity) = 0;
|
||||
|
||||
/** @brief Attach a new logstream
|
||||
* @param pStream Logstream to attach
|
||||
*/
|
||||
virtual void attachStream(LogStream *pStream, unsigned int severity) = 0;
|
||||
|
||||
/** @brief Detach a still attached stream from logger
|
||||
* @param pStream Logstream instance for detatching
|
||||
*/
|
||||
virtual void detatchStream(LogStream *pStream, unsigned int severity) = 0;
|
||||
|
||||
protected:
|
||||
/** @brief Default constructor */
|
||||
Logger();
|
||||
};
|
||||
// ---------------------------------------------------------------------------
|
||||
// Default constructor
|
||||
inline Logger::Logger()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Virtual destructor
|
||||
inline Logger::~Logger()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
} // Namespace Assimp
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue