From 36a612af9a2972174ff3c4bc68317369bc389d71 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 20 Apr 2018 18:54:58 +0700 Subject: [PATCH] Move logging code to common folder. --- CMakeLists.txt | 14 +++++++------- src/App.cpp | 4 +--- src/Mem_win.cpp | 2 +- src/Summary.cpp | 2 +- src/common/api/Httpd.cpp | 2 +- src/common/config/CommonConfig.cpp | 2 +- src/common/config/ConfigWatcher.cpp | 2 +- src/common/crypto/keccak.cpp | 2 +- src/{ => common}/log/ConsoleLog.cpp | 4 ++-- src/{ => common}/log/ConsoleLog.h | 0 src/{ => common}/log/FileLog.cpp | 2 +- src/{ => common}/log/FileLog.h | 0 src/{ => common}/log/Log.cpp | 2 +- src/{ => common}/log/Log.h | 0 src/{ => common}/log/SysLog.cpp | 2 +- src/{ => common}/log/SysLog.h | 0 src/common/net/Client.cpp | 2 +- src/common/net/Storage.h | 3 ++- src/core/Controller.cpp | 6 +++--- src/net/Network.cpp | 2 +- src/workers/Hashrate.cpp | 2 +- src/workers/Workers.cpp | 2 +- 22 files changed, 28 insertions(+), 29 deletions(-) rename src/{ => common}/log/ConsoleLog.cpp (98%) rename src/{ => common}/log/ConsoleLog.h (100%) rename src/{ => common}/log/FileLog.cpp (98%) rename src/{ => common}/log/FileLog.h (100%) rename src/{ => common}/log/Log.cpp (98%) rename src/{ => common}/log/Log.h (100%) rename src/{ => common}/log/SysLog.cpp (97%) rename src/{ => common}/log/SysLog.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06f0bef9e..e6c2d2d3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,9 +46,9 @@ set(HEADERS src/interfaces/IThread.h src/interfaces/IWatcherListener.h src/interfaces/IWorker.h - src/log/ConsoleLog.h - src/log/FileLog.h - src/log/Log.h + src/common/log/ConsoleLog.h + src/common/log/FileLog.h + src/common/log/Log.h src/Mem.h src/net/Job.h src/net/JobResult.h @@ -101,9 +101,9 @@ set(SOURCES src/common/Platform.cpp src/core/Config.cpp src/core/Controller.cpp - src/log/ConsoleLog.cpp - src/log/FileLog.cpp - src/log/Log.cpp + src/common/log/ConsoleLog.cpp + src/common/log/FileLog.cpp + src/common/log/Log.cpp src/Mem.cpp src/net/Job.cpp src/net/Network.cpp @@ -194,7 +194,7 @@ endif() CHECK_INCLUDE_FILE (syslog.h HAVE_SYSLOG_H) if (HAVE_SYSLOG_H) add_definitions(/DHAVE_SYSLOG_H) - set(SOURCES_SYSLOG src/log/SysLog.h src/log/SysLog.cpp) + set(SOURCES_SYSLOG src/common/log/SysLog.h src/common/log/SysLog.cpp) endif() if (NOT WITH_AEON) diff --git a/src/App.cpp b/src/App.cpp index e74476343..adcc57524 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -29,14 +29,12 @@ #include "api/Api.h" #include "App.h" #include "common/Console.h" +#include "common/log/Log.h" #include "common/Platform.h" #include "core/Config.h" #include "core/Controller.h" #include "Cpu.h" #include "crypto/CryptoNight.h" -#include "log/ConsoleLog.h" -#include "log/FileLog.h" -#include "log/Log.h" #include "Mem.h" #include "net/Network.h" #include "Summary.h" diff --git a/src/Mem_win.cpp b/src/Mem_win.cpp index 9a81b0396..2bfcc3b01 100644 --- a/src/Mem_win.cpp +++ b/src/Mem_win.cpp @@ -29,11 +29,11 @@ #include +#include "common/log/Log.h" #include "common/utils/mm_malloc.h" #include "common/xmrig.h" #include "crypto/CryptoNight.h" #include "crypto/CryptoNight_constants.h" -#include "log/Log.h" #include "Mem.h" diff --git a/src/Summary.cpp b/src/Summary.cpp index 12108d185..38ceac8ee 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -27,11 +27,11 @@ #include +#include "common/log/Log.h" #include "common/net/Pool.h" #include "core/Config.h" #include "core/Controller.h" #include "Cpu.h" -#include "log/Log.h" #include "Mem.h" #include "Summary.h" #include "version.h" diff --git a/src/common/api/Httpd.cpp b/src/common/api/Httpd.cpp index 135ac7c9a..0cab01bfd 100644 --- a/src/common/api/Httpd.cpp +++ b/src/common/api/Httpd.cpp @@ -30,7 +30,7 @@ #include "common/api/Httpd.h" #include "common/api/HttpReply.h" #include "common/api/HttpRequest.h" -#include "log/Log.h" +#include "common/log/Log.h" Httpd::Httpd(int port, const char *accessToken, bool IPv6, bool restricted) : diff --git a/src/common/config/CommonConfig.cpp b/src/common/config/CommonConfig.cpp index 7327b50c1..759066216 100644 --- a/src/common/config/CommonConfig.cpp +++ b/src/common/config/CommonConfig.cpp @@ -30,8 +30,8 @@ #include "common/config/CommonConfig.h" +#include "common/log/Log.h" #include "donate.h" -#include "log/Log.h" #include "rapidjson/document.h" #include "rapidjson/filewritestream.h" #include "rapidjson/prettywriter.h" diff --git a/src/common/config/ConfigWatcher.cpp b/src/common/config/ConfigWatcher.cpp index 21d73188f..a08b2be72 100644 --- a/src/common/config/ConfigWatcher.cpp +++ b/src/common/config/ConfigWatcher.cpp @@ -27,9 +27,9 @@ #include "common/config/ConfigLoader.h" #include "common/config/ConfigWatcher.h" +#include "common/log/Log.h" #include "core/ConfigCreator.h" #include "interfaces/IWatcherListener.h" -#include "log/Log.h" xmrig::ConfigWatcher::ConfigWatcher(const char *path, IConfigCreator *creator, IWatcherListener *listener) : diff --git a/src/common/crypto/keccak.cpp b/src/common/crypto/keccak.cpp index ecfe7700e..0219ce366 100644 --- a/src/common/crypto/keccak.cpp +++ b/src/common/crypto/keccak.cpp @@ -183,7 +183,7 @@ void xmrig::keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen) xmrig::keccakf(st, KECCAK_ROUNDS); } - + // last block and padding memcpy(temp, in, inlen); temp[inlen++] = 1; diff --git a/src/log/ConsoleLog.cpp b/src/common/log/ConsoleLog.cpp similarity index 98% rename from src/log/ConsoleLog.cpp rename to src/common/log/ConsoleLog.cpp index eeed7355e..b7d187d12 100644 --- a/src/log/ConsoleLog.cpp +++ b/src/common/log/ConsoleLog.cpp @@ -34,10 +34,10 @@ #endif +#include "common/log/ConsoleLog.h" +#include "common/log/Log.h" #include "core/Config.h" #include "core/Controller.h" -#include "log/ConsoleLog.h" -#include "log/Log.h" ConsoleLog::ConsoleLog(xmrig::Controller *controller) : diff --git a/src/log/ConsoleLog.h b/src/common/log/ConsoleLog.h similarity index 100% rename from src/log/ConsoleLog.h rename to src/common/log/ConsoleLog.h diff --git a/src/log/FileLog.cpp b/src/common/log/FileLog.cpp similarity index 98% rename from src/log/FileLog.cpp rename to src/common/log/FileLog.cpp index 5eeb252c8..c8eaf5f7c 100644 --- a/src/log/FileLog.cpp +++ b/src/common/log/FileLog.cpp @@ -29,7 +29,7 @@ #include -#include "log/FileLog.h" +#include "common/log/FileLog.h" FileLog::FileLog(const char *fileName) diff --git a/src/log/FileLog.h b/src/common/log/FileLog.h similarity index 100% rename from src/log/FileLog.h rename to src/common/log/FileLog.h diff --git a/src/log/Log.cpp b/src/common/log/Log.cpp similarity index 98% rename from src/log/Log.cpp rename to src/common/log/Log.cpp index 0e38634d7..03237f03a 100644 --- a/src/log/Log.cpp +++ b/src/common/log/Log.cpp @@ -29,8 +29,8 @@ #include +#include "common/log/Log.h" #include "interfaces/ILogBackend.h" -#include "log/Log.h" Log *Log::m_self = nullptr; diff --git a/src/log/Log.h b/src/common/log/Log.h similarity index 100% rename from src/log/Log.h rename to src/common/log/Log.h diff --git a/src/log/SysLog.cpp b/src/common/log/SysLog.cpp similarity index 97% rename from src/log/SysLog.cpp rename to src/common/log/SysLog.cpp index f9b16cca0..70879c33b 100644 --- a/src/log/SysLog.cpp +++ b/src/common/log/SysLog.cpp @@ -25,7 +25,7 @@ #include -#include "log/SysLog.h" +#include "common/log/SysLog.h" #include "version.h" diff --git a/src/log/SysLog.h b/src/common/log/SysLog.h similarity index 100% rename from src/log/SysLog.h rename to src/common/log/SysLog.h diff --git a/src/common/net/Client.cpp b/src/common/net/Client.cpp index c335634b2..2c28c89a9 100644 --- a/src/common/net/Client.cpp +++ b/src/common/net/Client.cpp @@ -29,9 +29,9 @@ #include +#include "common/log/Log.h" #include "common/net/Client.h" #include "interfaces/IClientListener.h" -#include "log/Log.h" #include "rapidjson/document.h" #include "rapidjson/error/en.h" #include "rapidjson/stringbuffer.h" diff --git a/src/common/net/Storage.h b/src/common/net/Storage.h index 105547ec5..752e9512b 100644 --- a/src/common/net/Storage.h +++ b/src/common/net/Storage.h @@ -28,7 +28,8 @@ #include #include -#include "log/Log.h" + +#include "common/log/Log.h" namespace xmrig { diff --git a/src/core/Controller.cpp b/src/core/Controller.cpp index 5f0a9bb3d..d0babe476 100644 --- a/src/core/Controller.cpp +++ b/src/core/Controller.cpp @@ -26,14 +26,14 @@ #include "common/config/ConfigLoader.h" +#include "common/log/ConsoleLog.h" +#include "common/log/FileLog.h" +#include "common/log/Log.h" #include "common/Platform.h" #include "core/Config.h" #include "core/Controller.h" #include "Cpu.h" #include "interfaces/IControllerListener.h" -#include "log/ConsoleLog.h" -#include "log/FileLog.h" -#include "log/Log.h" #include "net/Network.h" diff --git a/src/net/Network.cpp b/src/net/Network.cpp index 1fe02a359..5f6d73eef 100644 --- a/src/net/Network.cpp +++ b/src/net/Network.cpp @@ -31,13 +31,13 @@ #include "api/Api.h" +#include "common/log/Log.h" #include "common/net/Client.h" #include "common/net/strategies/FailoverStrategy.h" #include "common/net/strategies/SinglePoolStrategy.h" #include "common/net/SubmitResult.h" #include "core/Config.h" #include "core/Controller.h" -#include "log/Log.h" #include "net/Network.h" #include "net/strategies/DonateStrategy.h" #include "workers/Workers.h" diff --git a/src/workers/Hashrate.cpp b/src/workers/Hashrate.cpp index 7d2e6a4c5..60d3a6a29 100644 --- a/src/workers/Hashrate.cpp +++ b/src/workers/Hashrate.cpp @@ -29,9 +29,9 @@ #include +#include "common/log/Log.h" #include "core/Config.h" #include "core/Controller.h" -#include "log/Log.h" #include "workers/Hashrate.h" diff --git a/src/workers/Workers.cpp b/src/workers/Workers.cpp index 25e1d0685..1d2c1739a 100644 --- a/src/workers/Workers.cpp +++ b/src/workers/Workers.cpp @@ -26,12 +26,12 @@ #include "api/Api.h" +#include "common/log/Log.h" #include "core/Config.h" #include "core/Controller.h" #include "crypto/CryptoNight_constants.h" #include "interfaces/IJobResultListener.h" #include "interfaces/IThread.h" -#include "log/Log.h" #include "Mem.h" #include "rapidjson/document.h" #include "workers/Handle.h"