Add logging comments

This commit is contained in:
Joshua Ashton 2020-08-07 06:55:17 +01:00
parent 1a32bae941
commit 81e71dd452
1 changed files with 6 additions and 0 deletions

View File

@ -139,24 +139,30 @@ namespace Feather::Log
std::vector<Channel> m_channels; std::vector<Channel> m_channels;
}; };
// Logs a message, specifying a channel and log level
template <class S, typename... Args> template <class S, typename... Args>
void Msg(ChannelID channel, Level level, const S& fmt, Args... args) void Msg(ChannelID channel, Level level, const S& fmt, Args... args)
{ {
Logger::Instance().Log(channel, level, fmt, args...); Logger::Instance().Log(channel, level, fmt, args...);
} }
// Logs a general message for end-users
template <class S, typename... Args> template <class S, typename... Args>
void Info(const S& fmt, Args... args) { Msg(Channels::General, Level::Info, fmt, args...); } void Info(const S& fmt, Args... args) { Msg(Channels::General, Level::Info, fmt, args...); }
// Logs a potential problem of note
template <class S, typename... Args> template <class S, typename... Args>
void Warn(const S& fmt, Args... args) { Msg(Channels::General, Level::Warning, fmt, args...); } void Warn(const S& fmt, Args... args) { Msg(Channels::General, Level::Warning, fmt, args...); }
// Logs a serious problem
template <class S, typename... Args> template <class S, typename... Args>
void Error(const S& fmt, Args... args) { Msg(Channels::General, Level::Error, fmt, args...); } void Error(const S& fmt, Args... args) { Msg(Channels::General, Level::Error, fmt, args...); }
// Logs debug information for developers
template <class S, typename... Args> template <class S, typename... Args>
void Debug(const S& fmt, Args... args) { Msg(Channels::General, Level::Debug, fmt, args...); } void Debug(const S& fmt, Args... args) { Msg(Channels::General, Level::Debug, fmt, args...); }
// Logs fine grained debug information
template <class S, typename... Args> template <class S, typename... Args>
void Trace(const S& fmt, Args... args) { Msg(Channels::General, Level::Trace, fmt, args...); } void Trace(const S& fmt, Args... args) { Msg(Channels::General, Level::Trace, fmt, args...); }
} }