summaryrefslogtreecommitdiffstats
path: root/src/Logger.h
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2020-05-15 04:35:43 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-05-16 10:39:05 +0200
commit3189a3cbee8eb9d7ded7605776a75f35e5e2f122 (patch)
tree616ed3031baa99e1f34123b645c5b3cb6ed73223 /src/Logger.h
parentEnable some more clang-tidy linter checks (#4738) (diff)
downloadcuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.gz
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.bz2
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.lz
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.xz
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.tar.zst
cuberite-3189a3cbee8eb9d7ded7605776a75f35e5e2f122.zip
Diffstat (limited to '')
-rw-r--r--src/Logger.h32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/Logger.h b/src/Logger.h
index e0680e125..ef86b3313 100644
--- a/src/Logger.h
+++ b/src/Logger.h
@@ -6,19 +6,10 @@ class cLogger
{
public:
- enum eLogLevel
- {
- llRegular,
- llInfo,
- llWarning,
- llError,
- };
-
-
class cListener
{
public:
- virtual void Log(AString a_Message, eLogLevel a_LogLevel) = 0;
+ virtual void Log(std::string_view a_Message, eLogLevel a_LogLevel) = 0;
virtual ~cListener(){}
};
@@ -59,23 +50,17 @@ public:
};
/** Log a message formatted with a printf style formatting string. */
- void vLogPrintf(const char * a_Format, eLogLevel a_LogLevel, fmt::printf_args a_ArgList);
- template <typename... Args>
- void LogPrintf(const char * a_Format, eLogLevel a_LogLevel, const Args & ... args)
- {
- vLogPrintf(a_Format, a_LogLevel, fmt::make_printf_args(args...));
- }
+ void LogPrintf(
+ std::string_view a_Format, eLogLevel a_LogLevel, fmt::printf_args a_ArgList
+ );
/** Log a message formatted with a python style formatting string. */
- void vLogFormat(const char * a_Format, eLogLevel a_LogLevel, fmt::format_args a_ArgList);
- template <typename... Args>
- void LogFormat(const char * a_Format, eLogLevel a_LogLevel, const Args & ... args)
- {
- vLogFormat(a_Format, a_LogLevel, fmt::make_format_args(args...));
- }
+ void LogFormat(
+ std::string_view a_Format, eLogLevel a_LogLevel, fmt::format_args a_ArgList
+ );
/** Logs the simple text message at the specified log level. */
- void LogSimple(const AString & a_Message, eLogLevel a_LogLevel = llRegular);
+ void LogSimple(std::string_view a_Message, eLogLevel a_LogLevel = eLogLevel::Regular);
cAttachment AttachListener(std::unique_ptr<cListener> a_Listener);
@@ -88,6 +73,7 @@ private:
std::vector<std::unique_ptr<cListener>> m_LogListeners;
void DetachListener(cListener * a_Listener);
+ void LogLine(std::string_view a_Line, eLogLevel a_LogLevel);
};