28 _logDir(
sLog->GetLogsDir()),
37 std::string mode =
"a";
43 size_t dot_pos =
_fileName.find_last_of(
'.');
44 if (dot_pos != std::string::npos)
82 fprintf(file,
"%s%s\n", message->
prefix.c_str(), message->
text.c_str());
88 else if (exceedMaxSize)
101 std::string fullName(
_logDir + filename);
105 std::string newName(fullName);
106 newName.push_back(
'.');
108 std::replace(newName.begin(), newName.end(),
':',
'-');
109 rename(fullName.c_str(), newName.c_str());
112 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.
std::string getTimeStr() const
uint32 Size() const
@ Returns size of the log message content in bytes