This commit is contained in:
13038267101 2022-11-18 16:05:55 +08:00
commit cfb8957582
1 changed files with 4 additions and 6 deletions

View File

@ -37,6 +37,7 @@
extern std::string g_scanner_path; // Ending with '\\'
static std::string log_divider("=========================================================================\n");
class log_cls
{
@ -58,12 +59,7 @@ class log_cls
if (file_)
{
fseek(file_, 0, SEEK_END);
if (ftell(file_))
{
std::string sep("\n\n\n============================\n");
fwrite(sep.c_str(), 1, sep.length(), file_);
}
else
if (ftell(file_) == 0)
{
unsigned char bom[] = { 0x0ef, 0x0bb, 0x0bf };
fwrite(bom, sizeof(bom), 1, file_);
@ -71,6 +67,7 @@ class log_cls
std::string now(g_time_tag + hg_log::current_time() + g_time_tag);
now += truncate ? " trcated.\n" : " started.\n";
now.insert(0, log_divider);
fwrite(now.c_str(), 1, now.length(), file_);
}
@ -667,6 +664,7 @@ extern "C"
{
std::string now(log_cls::g_time_tag + hg_log::current_time() + log_cls::g_time_tag + " exited.\n");
log(now.c_str());
log((log_divider + "\n\n\n\n").c_str());
}
void log(int level, const char* info)
{