mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
extracted base logger class to vstd
This commit is contained in:
61
include/vstd/CLoggerBase.h
Normal file
61
include/vstd/CLoggerBase.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* CLoggerBase.h, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ELogLevel
|
||||
{
|
||||
enum ELogLevel
|
||||
{
|
||||
NOT_SET = 0,
|
||||
TRACE,
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARN,
|
||||
ERROR
|
||||
};
|
||||
}
|
||||
|
||||
namespace vstd
|
||||
{
|
||||
class DLL_LINKAGE CLoggerBase
|
||||
{
|
||||
public:
|
||||
virtual ~CLoggerBase(){};
|
||||
|
||||
virtual void log(ELogLevel::ELogLevel level, const std::string & message) const = 0;
|
||||
|
||||
/// Log methods for various log levels
|
||||
inline void trace(const std::string & message) const
|
||||
{
|
||||
log(ELogLevel::TRACE, message);
|
||||
};
|
||||
|
||||
inline void debug(const std::string & message) const
|
||||
{
|
||||
log(ELogLevel::DEBUG, message);
|
||||
};
|
||||
|
||||
inline void info(const std::string & message) const
|
||||
{
|
||||
log(ELogLevel::INFO, message);
|
||||
};
|
||||
|
||||
inline void warn(const std::string & message) const
|
||||
{
|
||||
log(ELogLevel::WARN, message);
|
||||
};
|
||||
|
||||
inline void error(const std::string & message) const
|
||||
{
|
||||
log(ELogLevel::ERROR, message);
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user