Implemented logging utilities
This commit is contained in:
24
source/log/include/LogUtils.hpp
Normal file
24
source/log/include/LogUtils.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "ILogFacility.hpp"
|
||||
|
||||
#include <format>
|
||||
|
||||
namespace ugly {
|
||||
|
||||
class LogAlias {
|
||||
public:
|
||||
ILogFacility *mpLog;
|
||||
|
||||
template<typename ...Args>
|
||||
LogAlias &operator()(std::format_string<Args...> format, Args &&...args) {
|
||||
if(mpLog) {
|
||||
mpLog->vlog(format.get(), std::make_format_args(args...));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
extern LogAlias log;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user