--- smsdaemon/main.cpp 2008/12/08 13:48:52 154 +++ smsdaemon/main.cpp 2008/12/10 22:02:28 175 @@ -1,8 +1,10 @@ #include #include +#include #include "daemon.h" -#include "common.h" +#include "Common.h" +#include "Logger.h" #include "ModemTransceiver.h" #include "DebugTransceiver.h" @@ -31,7 +33,7 @@ Common* cmn = Common::instance(); ConfigFile* config = cmn->GetConfigfile(); - port = new SerialPort ( config->GetValue("smsdaemon","serialport") ); + port = new SerialPort ( config->GetValue("gsmmodem","serialport") ); try { port->Open( SerialPort::BAUD_9600, @@ -42,7 +44,7 @@ } catch(std::exception &e) { - cmn->logMessage( string("PortOpen Exception: ") + e.what() ); + Logger::logMessage( string("PortOpen Exception: ") + e.what() ); sms_exit(1); } @@ -54,7 +56,7 @@ } catch (std::exception& e) { - cmn->logMessage( string("ModemTransceiver Exception: ") + e.what() ); + Logger::logMessage( string("ModemTransceiver Exception: ") + e.what() ); sms_exit(2); } } @@ -71,7 +73,7 @@ //Set default values - cmn->setLogfile( "/var/log/smsdaemon.log"); + Logger::setLogfile( "/var/log/smsdaemon.log"); cmn->pidfile = "/var/run/smsdaemon.pid"; cmn->spooldir = "/var/spool/smsdaemon"; @@ -83,9 +85,11 @@ bool res = config->Open( cmn->configFilePath ) ; if (!res) { - cmn->logMessage(string("Could not open config file:") + cmn->configFilePath); + cout << "Could not open config file:" << cmn->configFilePath << endl; return 1; } + + Logger::initLog(); ///////////////////// @@ -103,7 +107,7 @@ } else { - cmn->logMessage( string("Invalid transceiver setting: ")+transconf); + Logger::logMessage( string("Invalid transceiver setting: ")+transconf); exit(1); }