From dbac585e5c4080e95d4c4507d513ac5bc2ea011c Mon Sep 17 00:00:00 2001 From: arjen Date: Thu, 14 Aug 2003 10:28:37 +0000 Subject: [PATCH] Use parameters from a new section 'logging' with three configuration parameters: method - Output method to use for logging. destination - Name of the log output destination. level - Log level: Verbose output if greater than 0. --- src/gcm_input/gcm_input.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gcm_input/gcm_input.cpp b/src/gcm_input/gcm_input.cpp index 34d768b..137fb69 100644 --- a/src/gcm_input/gcm_input.cpp +++ b/src/gcm_input/gcm_input.cpp @@ -7,7 +7,7 @@ *********************** ** FILE NAME : gcm_input.cpp ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring -** VERSION NUMBER : $Revision: 1.6 $ +** VERSION NUMBER : $Revision: 1.7 $ ** ** DESCRIPTION : Application to store client messages into the database ** The client message contains a log file from one of the @@ -54,7 +54,13 @@ /***************************** $Log: gcm_input.cpp,v $ - Revision 1.6 2003-08-11 16:56:16 arjen + Revision 1.7 2003-08-14 10:28:37 arjen + Use parameters from a new section 'logging' with three configuration parameters: + method - Output method to use for logging. + destination - Name of the log output destination. + level - Log level: Verbose output if greater than 0. + + Revision 1.6 2003/08/11 16:56:16 arjen Different kinds of log files are parsed by a collection of objects of different classes, derived from the base class line_cooker Depending on the message content or the message_type element in @@ -84,7 +90,7 @@ *****************************/ -static const char *RCSID = "$Id: gcm_input.cpp,v 1.6 2003-08-11 16:56:16 arjen Exp $"; +static const char *RCSID = "$Id: gcm_input.cpp,v 1.7 2003-08-14 10:28:37 arjen Exp $"; #include @@ -195,22 +201,23 @@ int main(int argc, char *argv[]) exit(1); } - String logfile_name = cfg.find_parameter("gcm_input", "logfile"); - int verbosity = cfg.find_parameter("gcm_input", "verbosity"); + String log_method = cfg.find_parameter("logging", "method"); + String log_destination = cfg.find_parameter("logging", "destination"); + int level = cfg.find_parameter("gcm_input", "level"); - if (logfile_name != "") + if (log_method == "file" && log_destination != "") { - std::cerr << "Logging to " << logfile_name << ".\n"; - logfile.open(logfile_name, _IO_APPEND); // for gcc 2 + std::cerr << "Logging to " << log_destination << ".\n"; + logfile.open(log_destination, _IO_APPEND); // for gcc 2 //logfile.open(logfile_name, std::ios_base::app); // for gcc 3 if (!logfile) { - std::cerr << "Can't open logfile " << logfile_name << " for writing.\n"; + std::cerr << "Can't open logfile " << log_destination << " for writing.\n"; } else { log = &logfile; - verbose = verbose || verbosity > 0; + verbose = verbose || level > 0; } } -- 2.11.0