Commit 132ab65479e39023e48f7515c7a085ebb5d98e64

Authored by Eli de Faria Junior
1 parent bdcfe887
Exists in master

refactoring

cacic-daemon/cacicD/cacictimer.cpp
... ... @@ -33,11 +33,16 @@ void CacicTimer::mslot(){
33 33 QJsonObject resposta = OCacicComm->login(&ok);
34 34 if(resposta.isEmpty() || resposta.contains("error")){
35 35 //de vez enquando a conexão da erro, é bom tentar 2 vezes pra garantir.
  36 + QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no primeiro login.");
36 37 resposta = OCacicComm->login(&ok);
37 38 if(resposta.isEmpty() || resposta.contains("error")){
38   - QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no login.");
  39 + QLogger::QLog_Info("Cacic Daemon (Timer)", "Erro no segundo login.");
39 40 return;
  41 + }else{
  42 + QLogger::QLog_Info("Cacic Daemon (Timer)", "getLogin() success.");
40 43 }
  44 + }else{
  45 + QLogger::QLog_Info("Cacic Daemon (Timer)", "getLogin() success.");
41 46 }
42 47 }catch (...){
43 48 QLogger::QLog_Info("Cacic Daemon (Timer)", QString("Não foi possivel verificar a periodicidade no getConfig.json"));
... ...
install-cacic/installcacic.cpp
... ... @@ -4,7 +4,8 @@ InstallCacic::InstallCacic(QObject *parent) :
4 4 QObject(parent)
5 5 {
6 6 logManager = QLogger::QLoggerManager::getInstance();
7   - logManager->addDestination("./install.log","Install",QLogger::DebugLevel);
  7 + logManager->addDestination(this->applicationDirPath + "/Logs/cacicLog.txt","Install Cacic",QLogger::InfoLevel);
  8 + logManager->addDestination(this->applicationDirPath + "/Logs/cacicLog.txt","Install Cacic",QLogger::ErrorLevel);
8 9 }
9 10  
10 11 InstallCacic::~InstallCacic()
... ... @@ -14,7 +15,7 @@ InstallCacic::~InstallCacic()
14 15  
15 16 void InstallCacic::run(QStringList argv, int argc) {
16 17  
17   - QLogger::QLog_Debug("Install", "Inicio de instalacao");
  18 + QLogger::QLog_Info("Install Cacic", QString("Inicio de instalacao"));
18 19  
19 20 oCacicComm = new CacicComm();
20 21  
... ... @@ -130,6 +131,16 @@ QMap<QString, QString> InstallCacic::validaParametros(QStringList argv, int argc
130 131 }
131 132 return map;
132 133 }
  134 +QString InstallCacic::getApplicationDirPath() const
  135 +{
  136 + return applicationDirPath;
  137 +}
  138 +
  139 +void InstallCacic::setApplicationDirPath(const QString &value)
  140 +{
  141 + applicationDirPath = value;
  142 +}
  143 +
133 144  
134 145 QMap<QString, QString> InstallCacic::getArgumentos()
135 146 {
... ...
install-cacic/installcacic.h
... ... @@ -20,14 +20,16 @@ public:
20 20 void setArgumentos(QMap<QString, QString> value);
21 21 QMap<QString, QString> validaParametros(QStringList argv, int argc, bool *ok);
22 22 bool startProcess(QString pathprogram, bool wait, QStringList arguments);
23   -
24 23 void registro();
  24 + void setApplicationDirPath(const QString &value);
  25 +
25 26 private:
26 27 QMap<QString, QString> argumentos;
27 28 CacicComm *oCacicComm;
28 29 CACIC_Computer oCacicComputer;
29 30 CCacic oCacic;
30 31 QLogger::QLoggerManager *logManager;
  32 + QString applicationDirPath;
31 33 signals:
32 34 void finished();
33 35  
... ...
install-cacic/main.cpp
... ... @@ -9,6 +9,7 @@ int main(int argc, char *argv[])
9 9 for (int i = 0; i<argc; i++)
10 10 args.append(argv[i]);
11 11 InstallCacic *installcacic = new InstallCacic(&a);
  12 + installcacic->setApplicationDirPath(a.applicationDirPath());
12 13  
13 14 // This will cause the application to exit when
14 15 // the task signals finished.
... ...