33 lines
629 B
C++
33 lines
629 B
C++
#pragma once
|
|
|
|
#include "ILogFacility.hpp"
|
|
|
|
#include <format>
|
|
|
|
namespace ugly {
|
|
|
|
/**
|
|
* \brief Provides \c std::format -style variadic template functions for \ref ILogFacility.
|
|
*/
|
|
class LogAlias {
|
|
public:
|
|
ILogFacility *mpLog;
|
|
|
|
template<typename ...Args>
|
|
LogAlias &operator()(std::format_string<Args...> fmt, Args &&...args) {
|
|
if(mpLog) {
|
|
mpLog->vlog(fmt.get(), std::make_format_args(args...));
|
|
}
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* \brief Globally-shared log.
|
|
*
|
|
* Should be assigned to by the user, defaults to a null log.
|
|
*/
|
|
extern LogAlias log;
|
|
|
|
}
|