og-edopro/gframe/logging.cpp
Edoardo Lolletti c40951ba09 No longer depend on fmt for localtime
It was deprecated there, and costs nothing to have it defined by ourselves
2025-05-10 23:21:30 +02:00

17 lines
393 B
C++

#include "logging.h"
#include <ctime>
#include "fmt.h"
#include "file_stream.h"
#include "localtime.h"
namespace ygo {
void ErrorLog(epro::stringview msg) {
FileStream log{ EPRO_TEXT("error.log"), FileStream::out | FileStream::app };
if (!log.good())
return;
auto now = std::time(nullptr);
log << epro::format("[{:%Y-%m-%d %H:%M:%S}] {}", epro::localtime(now), msg) << std::endl;
}
}