From 132ab65479e39023e48f7515c7a085ebb5d98e64 Mon Sep 17 00:00:00 2001 From: Eli de Faria Junior Date: Mon, 6 Oct 2014 17:40:44 -0300 Subject: [PATCH] refactoring --- cacic-daemon/cacicD/cacictimer.cpp | 7 ++++++- install-cacic/installcacic.cpp | 15 +++++++++++++-- install-cacic/installcacic.h | 4 +++- install-cacic/main.cpp | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cacic-daemon/cacicD/cacictimer.cpp b/cacic-daemon/cacicD/cacictimer.cpp index c25c73f..4159977 100644 --- a/cacic-daemon/cacicD/cacictimer.cpp +++ b/cacic-daemon/cacicD/cacictimer.cpp @@ -33,11 +33,16 @@ void CacicTimer::mslot(){ QJsonObject resposta = OCacicComm->login(&ok); if(resposta.isEmpty() || resposta.contains("error")){ //de vez enquando a conexão da erro, é bom tentar 2 vezes pra garantir. + QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no primeiro login."); resposta = OCacicComm->login(&ok); if(resposta.isEmpty() || resposta.contains("error")){ - QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no login."); + QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no segundo login."); return; + }else{ + QLogger::QLog_Info("Cacic Daemon (Timer)", "getLogin() success."); } + }else{ + QLogger::QLog_Info("Cacic Daemon (Timer)", "getLogin() success."); } }catch (...){ QLogger::QLog_Info("Cacic Daemon (Timer)", QString("Não foi possivel verificar a periodicidade no getConfig.json")); diff --git a/install-cacic/installcacic.cpp b/install-cacic/installcacic.cpp index eb85cb7..8b5608d 100644 --- a/install-cacic/installcacic.cpp +++ b/install-cacic/installcacic.cpp @@ -4,7 +4,8 @@ InstallCacic::InstallCacic(QObject *parent) : QObject(parent) { logManager = QLogger::QLoggerManager::getInstance(); - logManager->addDestination("./install.log","Install",QLogger::DebugLevel); + logManager->addDestination(this->applicationDirPath + "/Logs/cacicLog.txt","Install Cacic",QLogger::InfoLevel); + logManager->addDestination(this->applicationDirPath + "/Logs/cacicLog.txt","Install Cacic",QLogger::ErrorLevel); } InstallCacic::~InstallCacic() @@ -14,7 +15,7 @@ InstallCacic::~InstallCacic() void InstallCacic::run(QStringList argv, int argc) { - QLogger::QLog_Debug("Install", "Inicio de instalacao"); + QLogger::QLog_Info("Install Cacic", QString("Inicio de instalacao")); oCacicComm = new CacicComm(); @@ -130,6 +131,16 @@ QMap InstallCacic::validaParametros(QStringList argv, int argc } return map; } +QString InstallCacic::getApplicationDirPath() const +{ + return applicationDirPath; +} + +void InstallCacic::setApplicationDirPath(const QString &value) +{ + applicationDirPath = value; +} + QMap InstallCacic::getArgumentos() { diff --git a/install-cacic/installcacic.h b/install-cacic/installcacic.h index 8b791d1..3fdfe43 100644 --- a/install-cacic/installcacic.h +++ b/install-cacic/installcacic.h @@ -20,14 +20,16 @@ public: void setArgumentos(QMap value); QMap validaParametros(QStringList argv, int argc, bool *ok); bool startProcess(QString pathprogram, bool wait, QStringList arguments); - void registro(); + void setApplicationDirPath(const QString &value); + private: QMap argumentos; CacicComm *oCacicComm; CACIC_Computer oCacicComputer; CCacic oCacic; QLogger::QLoggerManager *logManager; + QString applicationDirPath; signals: void finished(); diff --git a/install-cacic/main.cpp b/install-cacic/main.cpp index 1e06ac7..c8e9aee 100644 --- a/install-cacic/main.cpp +++ b/install-cacic/main.cpp @@ -9,6 +9,7 @@ int main(int argc, char *argv[]) for (int i = 0; isetApplicationDirPath(a.applicationDirPath()); // This will cause the application to exit when // the task signals finished. -- libgit2 0.21.2