27 _logDir(
sLog->GetLogsDir()),
36 std::string mode =
"a";
42 size_t dot_pos =
_fileName.find_last_of(
'.');
43 if (dot_pos != std::string::npos)
81 fprintf(file,
"%s%s\n", message->
prefix.c_str(), message->
text.c_str());
87 else if (exceedMaxSize)
100 std::string fullName(
_logDir + filename);
104 std::string newName(fullName);
105 newName.push_back(
'.');
107 std::replace(newName.begin(), newName.end(),
':',
'-');
108 rename(fullName.c_str(), newName.c_str());
111 if (FILE* ret = fopen(fullName.c_str(), mode.c_str()))
@ APPENDER_FLAGS_MAKE_FILE_BACKUP
@ APPENDER_FLAGS_USE_TIMESTAMP
std::optional< T > Optional
Optional helper class to wrap optional values within.
std::atomic< uint64 > _fileSize
AppenderFile(uint8 id, std::string const &name, LogLevel level, AppenderFlags flags, std::vector< std::string_view > const &args)
void _write(LogMessage const *message) override
FILE * OpenFile(std::string const &name, std::string const &mode, bool backup)
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
constexpr std::size_t size()
std::string getTimeStr() const
uint32 Size() const
@ Returns size of the log message content in bytes