start working on 0.7.x branch
- added FileLog which stores content to the file log - now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog - new base classes: WinixBase (Log, Config*, Synchro*) WinixModel : public WinixBase (morm::ModelConnector*, Plugin*) WinixSystem : public WinixModel (System*) WinixRequest : public WinixSystem (SLog, Cur*) - singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel) - DbBase, DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer) each thread will have its own ModelConnector git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -40,23 +40,16 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "core/log.h"
|
||||
#include "core/slog.h"
|
||||
#include "core/app.h"
|
||||
#include "core/plugin.h"
|
||||
#include "core/version.h"
|
||||
#include "utf8/utf8.h"
|
||||
#include "core/filelog.h"
|
||||
|
||||
|
||||
|
||||
namespace Winix
|
||||
{
|
||||
|
||||
Log log;
|
||||
Log nlog; // notify log (used by a notification thread)
|
||||
SLog slog; // session logger
|
||||
Plugin plugin;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -108,7 +101,7 @@ 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.PrintDate(PT::Date(std::time(0)));
|
||||
log << ' ' << msg;
|
||||
|
||||
if( put_version )
|
||||
@@ -191,12 +184,11 @@ using Winix::app;
|
||||
if( app.config.demonize && !app.Demonize() )
|
||||
return 4;
|
||||
|
||||
Winix::log.SetTimeZones(&app.system.time_zones);
|
||||
|
||||
Winix::log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_file,
|
||||
app.config.log_stdout, app.config.log_request);
|
||||
app.InitFileLog();
|
||||
|
||||
Winix::nlog.Init(app.config.log_level, true, app.config.log_notify_file, false, 1);
|
||||
Winix::log.SetFileLog(&app.file_log); // IMPROVE ME the singleton will be removed
|
||||
Winix::log.Init(app.config.log_level, app.config.log_save_each_line, app.config.log_request);
|
||||
|
||||
Winix::LogInfo(Winix::log3, "booting Winix", true, "");
|
||||
|
||||
@@ -212,7 +204,7 @@ using Winix::app;
|
||||
|
||||
// load plugins before loading sessions - session_manager.LoadSessions()
|
||||
// because some of the plugins can init its own sessions dates
|
||||
Winix::plugin.LoadPlugins(app.config.plugins_dir, app.config.plugin_file);
|
||||
app.InitPlugins();
|
||||
|
||||
// app.Init() starts other threads as well (they will be waiting on the lock)
|
||||
if( !app.Init() )
|
||||
@@ -233,14 +225,7 @@ using Winix::app;
|
||||
// main loop
|
||||
app.Start();
|
||||
|
||||
app.Lock();
|
||||
Winix::plugin.Call((Winix::Session*)0, WINIX_CLOSE);
|
||||
app.Close();
|
||||
// now all sessions are cleared
|
||||
app.Unlock();
|
||||
|
||||
app.WaitForThreads();
|
||||
// now all others threads are terminated
|
||||
|
||||
Winix::LogInfo(Winix::log1, "Winix", true, "stopped");
|
||||
Winix::RemovePidFile();
|
||||
|
Reference in New Issue
Block a user