added: to config: log_time_zone_id (size_t) identifier

this is the time zone identifier used in log messages



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@882 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-09-06 17:50:14 +00:00
parent 0c6ddc2218
commit 9174555ff8
8 changed files with 77 additions and 7 deletions

View File

@@ -55,4 +55,4 @@ main.o: ../core/sessionmanager.h ../core/compress.h ../core/postparser.h
main.o: ../core/httpsimpleparser.h ../core/plugin.h ../core/pluginmsg.h
main.o: ../core/cookieparser.h ../core/postmultiparser.h
main.o: ../core/acceptencodingparser.h ../core/acceptbaseparser.h
main.o: ../core/plugin.h
main.o: ../core/plugin.h ../core/version.h

View File

@@ -17,6 +17,7 @@
#include "core/slog.h"
#include "core/app.h"
#include "core/plugin.h"
#include "core/version.h"
Log log;
@@ -72,6 +73,22 @@ void CloseDescriptors()
}
void LogInfo(LogManipulators log_level, const char * msg, bool put_version, const char * msg2)
{
log << log_level;
log.PrintDate(PT::Date(std::time(0)), app.config.log_time_zone_id);
log << ' ' << msg;
if( put_version )
{
log << ' ' << WINIX_VER_MAJOR
<< '.' << WINIX_VER_MINOR
<< '.' << WINIX_VER_REVISION;
}
log << ' ' << msg2 << logend;
}
int main(int argv, char ** argc)
@@ -99,12 +116,14 @@ int main(int argv, char ** argc)
if( app.config.demonize && !app.Demonize() )
return 4;
log.SetTimeZones(&app.system.time_zones);
log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
app.config.log_stdout, app.config.log_request);
nlog.Init(app.config.log_level, true, app.config.log_notify_file, false, 1);
log << log3 << "-- preparing to start winix --" << logend;
LogInfo(log3, "booting Winix", true, "");
if( !app.InitFCGI() )
return 5;
@@ -124,13 +143,12 @@ int main(int argv, char ** argc)
if( !app.Init() )
return 1;
log << log1 << PT::Date(std::time(0)) << " winix started" << logend;
app.StartThreads();
// now we have more threads, we should use Lock() and Unlock()
// saving all starting logs
app.Lock();
LogInfo(log1, "Winix", true, "started");
log << logsave;
app.Unlock();
@@ -146,7 +164,7 @@ int main(int argv, char ** argc)
app.WaitForThreads();
// now all others threads are terminated
log << log1 << PT::Date(std::time(0)) << " winix stopped" << logend << logsave;
LogInfo(log1, "Winix", true, "stopped");
return 0;
}