Minor refactoring
This commit is contained in:
@@ -7,6 +7,7 @@ namespace ugly {
|
||||
|
||||
class ILogFacility {
|
||||
public:
|
||||
~ILogFacility() = default;
|
||||
virtual void vlog(std::string_view fmt, std::format_args args) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ public:
|
||||
ILogFacility *mpLog;
|
||||
|
||||
template<typename ...Args>
|
||||
LogAlias &operator()(std::format_string<Args...> format, Args &&...args) {
|
||||
LogAlias &operator()(std::format_string<Args...> fmt, Args &&...args) {
|
||||
if(mpLog) {
|
||||
mpLog->vlog(format.get(), std::make_format_args(args...));
|
||||
mpLog->vlog(fmt.get(), std::make_format_args(args...));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ namespace ugly {
|
||||
|
||||
class TimestampLog: virtual public ILogFacility {
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point mStartTime;
|
||||
std::ostream &mrOutputStream;
|
||||
std::string mDescription;
|
||||
std::chrono::high_resolution_clock::time_point mStart;
|
||||
|
||||
public:
|
||||
TimestampLog(std::ostream &os, std::string_view description);
|
||||
TimestampLog(std::string_view description, std::ostream &os);
|
||||
void vlog(std::string_view fmt, std::format_args args) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user