added: program reads its configuration from a config file
added: confparser directory and confparser.h and confparser.cpp class ConfParser used to parse a config file this is a generic parser, can be used by another project added: config.h, config.cpp class Config used for assigning values from a config file into the data object added: function for signals: SIGINT, SIGHUP after receiving SIGHUP the program will read its config file again git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@463 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
60
core/log.cpp
60
core/log.cpp
@@ -13,10 +13,8 @@
|
||||
|
||||
Log::Log()
|
||||
{
|
||||
log_level = 1;
|
||||
current_level = 2;
|
||||
log_file = "cmslu.log";
|
||||
log_stdout = true;
|
||||
log_level = 3;
|
||||
current_level = 4; // nothing to log (call Init() first)
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +25,7 @@ void Log::Init(int log_l, const std::string & log_f, bool log_std)
|
||||
log_stdout = log_std;
|
||||
}
|
||||
|
||||
// zrobic templeta z tych metod
|
||||
// i dla const char * zrobic specjalizacje
|
||||
|
||||
|
||||
Log & Log::operator<<(const char * s)
|
||||
{
|
||||
@@ -64,14 +61,7 @@ Log & Log::operator<<(long s)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
Log & Log::operator<<(void * s)
|
||||
{
|
||||
buffer << s;
|
||||
|
||||
return *this;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Log & Log::operator<<(char s)
|
||||
@@ -92,28 +82,27 @@ Log & Log::operator<<(size_t s)
|
||||
|
||||
Log & Log::operator<<(Manipulators m)
|
||||
{
|
||||
switch(m)
|
||||
{
|
||||
case logend:
|
||||
SaveLog();
|
||||
buffer.str( "" );
|
||||
break;
|
||||
switch(m)
|
||||
{
|
||||
case logend:
|
||||
SaveLog();
|
||||
buffer.str( "" );
|
||||
break;
|
||||
|
||||
case log1:
|
||||
current_level = 1;
|
||||
break;
|
||||
|
||||
case log2:
|
||||
current_level = 2;
|
||||
break;
|
||||
|
||||
case log3:
|
||||
current_level = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
case log1:
|
||||
current_level = 1;
|
||||
break;
|
||||
|
||||
case log2:
|
||||
current_level = 2;
|
||||
break;
|
||||
|
||||
case log3:
|
||||
current_level = 3;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +118,9 @@ int attempt = 2;
|
||||
std::cout << buffer.str() << std::endl;
|
||||
|
||||
|
||||
if( log_file.empty() )
|
||||
return;
|
||||
|
||||
std::ofstream file;
|
||||
|
||||
do
|
||||
|
Reference in New Issue
Block a user