fixed: when demonizing there were some logs info put twice in the log file
now we first demonize (fork) and then open the log file added: start adding support for PT::Date we are using instead of tz system structure git-svn-id: svn://ttmath.org/publicrep/winix/trunk@836 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
28
core/log.cpp
28
core/log.cpp
@@ -54,24 +54,6 @@ void Log::OpenFile()
|
||||
}
|
||||
|
||||
|
||||
void Log::PutDate(LogManipulators m)
|
||||
{
|
||||
// logs are related to localtime
|
||||
|
||||
time_t t = std::time(0);
|
||||
std::tm * loct = std::localtime(&t);
|
||||
|
||||
char buffer[70];
|
||||
sprintf(buffer, "%d.%02d.%02d %02d:%02d:%02d ", int(loct->tm_year + 1900),
|
||||
int(loct->tm_mon + 1),
|
||||
int(loct->tm_mday),
|
||||
int(loct->tm_hour),
|
||||
int(loct->tm_min),
|
||||
int(loct->tm_sec));
|
||||
|
||||
(*this) << m << buffer;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::operator<<(const void * s)
|
||||
{
|
||||
@@ -253,7 +235,17 @@ Log & Log::operator<<(const tm & tm_)
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Log & Log::operator<<(const PT::Date & date)
|
||||
{
|
||||
if( current_level <= log_level )
|
||||
{
|
||||
buffer << date;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user