Commit 132ab65479e39023e48f7515c7a085ebb5d98e64
1 parent
bdcfe887
Exists in
master
refactoring
Showing
4 changed files
with
23 additions
and
4 deletions
Show diff stats
cacic-daemon/cacicD/cacictimer.cpp
@@ -33,11 +33,16 @@ void CacicTimer::mslot(){ | @@ -33,11 +33,16 @@ void CacicTimer::mslot(){ | ||
33 | QJsonObject resposta = OCacicComm->login(&ok); | 33 | QJsonObject resposta = OCacicComm->login(&ok); |
34 | if(resposta.isEmpty() || resposta.contains("error")){ | 34 | if(resposta.isEmpty() || resposta.contains("error")){ |
35 | //de vez enquando a conexão da erro, é bom tentar 2 vezes pra garantir. | 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 | resposta = OCacicComm->login(&ok); | 37 | resposta = OCacicComm->login(&ok); |
37 | if(resposta.isEmpty() || resposta.contains("error")){ | 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 | return; | 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 | }catch (...){ | 47 | }catch (...){ |
43 | QLogger::QLog_Info("Cacic Daemon (Timer)", QString("Não foi possivel verificar a periodicidade no getConfig.json")); | 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,7 +4,8 @@ InstallCacic::InstallCacic(QObject *parent) : | ||
4 | QObject(parent) | 4 | QObject(parent) |
5 | { | 5 | { |
6 | logManager = QLogger::QLoggerManager::getInstance(); | 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 | InstallCacic::~InstallCacic() | 11 | InstallCacic::~InstallCacic() |
@@ -14,7 +15,7 @@ InstallCacic::~InstallCacic() | @@ -14,7 +15,7 @@ InstallCacic::~InstallCacic() | ||
14 | 15 | ||
15 | void InstallCacic::run(QStringList argv, int argc) { | 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 | oCacicComm = new CacicComm(); | 20 | oCacicComm = new CacicComm(); |
20 | 21 | ||
@@ -130,6 +131,16 @@ QMap<QString, QString> InstallCacic::validaParametros(QStringList argv, int argc | @@ -130,6 +131,16 @@ QMap<QString, QString> InstallCacic::validaParametros(QStringList argv, int argc | ||
130 | } | 131 | } |
131 | return map; | 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 | QMap<QString, QString> InstallCacic::getArgumentos() | 145 | QMap<QString, QString> InstallCacic::getArgumentos() |
135 | { | 146 | { |
install-cacic/installcacic.h
@@ -20,14 +20,16 @@ public: | @@ -20,14 +20,16 @@ public: | ||
20 | void setArgumentos(QMap<QString, QString> value); | 20 | void setArgumentos(QMap<QString, QString> value); |
21 | QMap<QString, QString> validaParametros(QStringList argv, int argc, bool *ok); | 21 | QMap<QString, QString> validaParametros(QStringList argv, int argc, bool *ok); |
22 | bool startProcess(QString pathprogram, bool wait, QStringList arguments); | 22 | bool startProcess(QString pathprogram, bool wait, QStringList arguments); |
23 | - | ||
24 | void registro(); | 23 | void registro(); |
24 | + void setApplicationDirPath(const QString &value); | ||
25 | + | ||
25 | private: | 26 | private: |
26 | QMap<QString, QString> argumentos; | 27 | QMap<QString, QString> argumentos; |
27 | CacicComm *oCacicComm; | 28 | CacicComm *oCacicComm; |
28 | CACIC_Computer oCacicComputer; | 29 | CACIC_Computer oCacicComputer; |
29 | CCacic oCacic; | 30 | CCacic oCacic; |
30 | QLogger::QLoggerManager *logManager; | 31 | QLogger::QLoggerManager *logManager; |
32 | + QString applicationDirPath; | ||
31 | signals: | 33 | signals: |
32 | void finished(); | 34 | void finished(); |
33 | 35 |
install-cacic/main.cpp
@@ -9,6 +9,7 @@ int main(int argc, char *argv[]) | @@ -9,6 +9,7 @@ int main(int argc, char *argv[]) | ||
9 | for (int i = 0; i<argc; i++) | 9 | for (int i = 0; i<argc; i++) |
10 | args.append(argv[i]); | 10 | args.append(argv[i]); |
11 | InstallCacic *installcacic = new InstallCacic(&a); | 11 | InstallCacic *installcacic = new InstallCacic(&a); |
12 | + installcacic->setApplicationDirPath(a.applicationDirPath()); | ||
12 | 13 | ||
13 | // This will cause the application to exit when | 14 | // This will cause the application to exit when |
14 | // the task signals finished. | 15 | // the task signals finished. |