From e438e88b0c63e2dcb44d74b4898b59e17eeff0d7 Mon Sep 17 00:00:00 2001 From: LRi Date: Tue, 1 Sep 2020 08:38:33 +0200 Subject: [PATCH] MinGW-w64 build v.1.5.0 --- CMakeLists.txt | 3 +- README.md | 8 +++++ .../{logger.hpp => logger_interface.hpp} | 21 +++++------ src/tello/command/validator_util.hpp | 1 + src/tello/connection/network.cpp | 18 +++++----- src/tello/connection/network.hpp | 20 ++++++----- src/tello/connection/udp_command_listener.cpp | 12 +++---- src/tello/connection/udp_command_listener.hpp | 4 +-- src/tello/connection/udp_listener.hpp | 18 +++++----- src/tello/logger/CMakeLists.txt | 6 +++- src/tello/logger/logger.cpp | 30 +++++++++------- src/tello/logger/logger.hpp | 35 +++++++++++++++++++ src/tello/logger/logger_interface.cpp | 29 +++++++++++++++ src/tello/native/tello_network.cpp | 2 ++ src/tello/native/windows/network_impl.cpp | 18 +++++----- src/tello/response/query_response.cpp | 10 +++--- src/tello/response/video_response.cpp | 2 ++ src/tello/tello.cpp | 2 +- src/tello/video_analyzer.cpp | 2 +- .../shared_linking_test/src/environment.cpp | 6 ++-- .../src/shared_linking_test.cpp | 10 +++--- test/src/tello/environment.cpp | 6 ++-- test/src/tello/video_test.cpp | 6 ++-- 23 files changed, 177 insertions(+), 92 deletions(-) rename include/tello/logger/{logger.hpp => logger_interface.hpp} (59%) create mode 100644 src/tello/logger/logger.hpp create mode 100644 src/tello/logger/logger_interface.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index cacf02b..5fcc573 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,5 +34,4 @@ add_subdirectory(lib) add_subdirectory(src) add_subdirectory(test) -target_link_libraries(tello PUBLIC spdlog) -target_link_libraries(tello PRIVATE ws2_32 ctpl) +target_link_libraries(tello PRIVATE ws2_32 ctpl spdlog) diff --git a/README.md b/README.md index c541d8c..d83f21a 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,14 @@ Note: The target 'tello_test' cannot be built with this option on,
because there are some usages, which are not exported (e.g. command_test.cpp).
Use the target 'shared_linking_test' instead. +### OS & Compiler +OS +- Windows + +Compiler +- nmake +- mingw/g++ + ## Third-party libs - Logging: spdlog (https://github.com/gabime/spdlog) - Thread-pooling: ctpl (https://github.com/vit-vit/CTPL) diff --git a/include/tello/logger/logger.hpp b/include/tello/logger/logger_interface.hpp similarity index 59% rename from include/tello/logger/logger.hpp rename to include/tello/logger/logger_interface.hpp index bf4da5c..5ce9450 100644 --- a/include/tello/logger/logger.hpp +++ b/include/tello/logger/logger_interface.hpp @@ -1,14 +1,14 @@ #pragma once #include -#include -#include #include "../macro_definition.hpp" using std::string; -using spdlog::logger; namespace tello { + + class Logger; + struct EXPORT LoggerSettings { public: LoggerSettings(string commandFileLocation, string videoFileLocation, @@ -25,16 +25,13 @@ namespace tello { STATUS }; - class EXPORT Logger { + class EXPORT LoggerInterface { public: - Logger() = delete; - [[nodiscard]] - static std::shared_ptr get(const LoggerType& loggerType); - static void initialize(const LoggerSettings& settings); + LoggerInterface() = delete; - private: - static std::shared_ptr _commandLogger; - static std::shared_ptr _videoLogger; - static std::shared_ptr _statusLogger; + static void info(const LoggerType& loggerType, const string& message, const string& params...); + static void error(const LoggerType& loggerType, const string& message, const string& params...); + static void warn(const LoggerType& loggerType, const string& message, const string& params...); + static void initialize(const LoggerSettings& settings); }; } \ No newline at end of file diff --git a/src/tello/command/validator_util.hpp b/src/tello/command/validator_util.hpp index b5c29fe..504d04c 100644 --- a/src/tello/command/validator_util.hpp +++ b/src/tello/command/validator_util.hpp @@ -2,6 +2,7 @@ #include #include +#include using std::string; using std::vector; diff --git a/src/tello/connection/network.cpp b/src/tello/connection/network.cpp index dc7253e..a01a8d6 100644 --- a/src/tello/connection/network.cpp +++ b/src/tello/connection/network.cpp @@ -38,27 +38,27 @@ bool tello::Network::connect() { _connectionMutex.lock(); _commandConnection = command.value(); _connectionMutex.unlock(); - Logger::get(LoggerType::COMMAND)->info(string("Command-Port connected")); + LoggerInterface::info(LoggerType::COMMAND, string("Command-Port connected"), ""); } else { - Logger::get(LoggerType::COMMAND)->info(string("Command-Port not connected")); + LoggerInterface::info(LoggerType::COMMAND, string("Command-Port not connected"), ""); } if (status) { _connectionMutex.lock(); _statusConnection = status.value(); _connectionMutex.unlock(); - Logger::get(LoggerType::STATUS)->info(string("Status-Port connected")); + LoggerInterface::info(LoggerType::STATUS, string("Status-Port connected"), ""); } else { - Logger::get(LoggerType::STATUS)->info(string("Status-Port not connected")); + LoggerInterface::info(LoggerType::STATUS, string("Status-Port not connected"), ""); } if (video) { _connectionMutex.lock(); _videoConnection = video.value(); _connectionMutex.unlock(); - Logger::get(LoggerType::VIDEO)->info(string("Video-Port connected")); + LoggerInterface::info(LoggerType::VIDEO, string("Video-Port connected"), ""); } else { - Logger::get(LoggerType::VIDEO)->info(string("Video-Port not connected")); + LoggerInterface::info(LoggerType::VIDEO, string("Video-Port not connected"), ""); } return isConnected; @@ -86,7 +86,7 @@ void tello::Network::disconnect() { optional tello::Network::connectToPort(unsigned short port, const ConnectionData& data, const LoggerType& loggerType) { if (data._fileDescriptor != -1) { - Logger::get(loggerType)->warn(string("Is already connected!")); + LoggerInterface::warn(loggerType, string("Is already connected!"), ""); return std::make_optional(data); } @@ -96,10 +96,10 @@ tello::Network::connectToPort(unsigned short port, const ConnectionData& data, c void tello::Network::disconnect(ConnectionData& connectionData, const LoggerType& loggerType) { bool disconnected = networkInterface->disconnect(connectionData._fileDescriptor); if (disconnected) { - Logger::get(loggerType)->info(string("Socket closed")); + LoggerInterface::info(loggerType, string("Socket closed"), ""); _commandConnection._fileDescriptor = -1; } else { - Logger::get(loggerType)->error(string("Socket not closed")); + LoggerInterface::error(loggerType, string("Socket not closed"), ""); } } diff --git a/src/tello/connection/network.hpp b/src/tello/connection/network.hpp index 8e99439..3532d67 100644 --- a/src/tello/connection/network.hpp +++ b/src/tello/connection/network.hpp @@ -7,9 +7,10 @@ #include "tello/native/network_interface.hpp" #include "tello/video_analyzer.hpp" #include "../command/command.hpp" -#include "tello/logger/logger.hpp" +#include "tello/logger/logger_interface.hpp" #include "udp_command_listener.hpp" #include "../thread/thread_pool.hpp" +#include #include using tello::ConnectionData; @@ -21,7 +22,7 @@ using std::unique_ptr; using tello::NetworkInterface; using tello::VideoAnalyzer; using tello::Command; -using tello::Logger; +using tello::LoggerInterface; using tello::UdpCommandListener; using std::vector; using tello::threading::Threadpool; @@ -84,12 +85,12 @@ namespace tello { unordered_map> responses{}; string errorMessage = command.validate(); if (!errorMessage.empty()) { - Logger::get(LoggerType::COMMAND)->error( + LoggerInterface::error(LoggerType::COMMAND, string("Command of type [{}] is not valid"), NAMES.find(command.type())->second); - Logger::get(LoggerType::COMMAND)->error(string("Message is: {}"), errorMessage); + LoggerInterface::error(LoggerType::COMMAND, string("Message is: {}"), errorMessage); for (auto tello : tellos) { - CommandResponse& response = CommandResponse{Status::FAIL}; + CommandResponse response = CommandResponse{Status::FAIL}; promise errorProm{}; errorProm.set_value(response); responses[tello.first] = std::move(errorProm.get_future()); @@ -106,7 +107,7 @@ namespace tello { commandString); _connectionMutex.unlock_shared(); if (result == SEND_ERROR_CODE) { - Logger::get(LoggerType::COMMAND)->info( + LoggerInterface::info(LoggerType::COMMAND, string("Command of type [{}] is not sent cause of socket error!"), NAMES.find(command.type())->second); @@ -117,14 +118,15 @@ namespace tello { tellos.erase(tello->first); } else { - Logger::get(LoggerType::COMMAND)->info( - string("Command of type [{0}] is sent to {1:x}!"), NAMES.find(command.type())->second, - tello->second->_clientaddr._ip); + LoggerInterface::info(LoggerType::COMMAND, + string("Command of type [{0}] is sent to {1}!"), NAMES.find(command.type())->second, + std::to_string(tello->second->_clientaddr._ip)); } } if (command.hasResponse()) { vector openResponses{}; + openResponses.reserve(tellos.size()); for(auto aTello : tellos) { openResponses.push_back(aTello.first); } diff --git a/src/tello/connection/udp_command_listener.cpp b/src/tello/connection/udp_command_listener.cpp index a77cb37..0347f04 100644 --- a/src/tello/connection/udp_command_listener.cpp +++ b/src/tello/connection/udp_command_listener.cpp @@ -62,8 +62,8 @@ void tello::UdpCommandListener::listen(const tello::ConnectionData& connectionDa connectionMutex.unlock_shared(); continue; } else if (isFirstAccessToFileDescriptor) { - Logger::get(LoggerType::COMMAND)->info(string("Start listen to port {0:d}"), - connectionData._networkData._port); + LoggerInterface::info(LoggerType::COMMAND, string("Start listen to port {0}"), + std::to_string(connectionData._networkData._port)); isFirstAccessToFileDescriptor = false; } @@ -76,8 +76,8 @@ void tello::UdpCommandListener::listen(const tello::ConnectionData& connectionDa bool correctSender = sender != mapping.end(); if (!correctSender) { - Logger::get(LoggerType::COMMAND)->error( - string("Answer from wrong tello received {0:x}"), senderIp); + LoggerInterface::error(LoggerType::COMMAND, + string("Answer from wrong tello received {0}"), std::to_string(senderIp)); } else { string answer = networkResponse.response(); shared_ptr response = sender->second.at(0); @@ -98,8 +98,8 @@ void tello::UdpCommandListener::listen(const tello::ConnectionData& connectionDa } } - Logger::get(LoggerType::COMMAND)->info(string("Stop listen to port {0:d}"), - connectionData._networkData._port); + LoggerInterface::info(LoggerType::COMMAND, string("Stop listen to port {0}"), + std::to_string(connectionData._networkData._port)); } time_t tello::UdpCommandListener::currentTime() { diff --git a/src/tello/connection/udp_command_listener.hpp b/src/tello/connection/udp_command_listener.hpp index c83c69e..28834f2 100644 --- a/src/tello/connection/udp_command_listener.hpp +++ b/src/tello/connection/udp_command_listener.hpp @@ -4,7 +4,7 @@ #include #include #include -#include "tello/logger/logger.hpp" +#include "tello/logger/logger_interface.hpp" #include "tello/native/network_interface.hpp" #include #include @@ -19,7 +19,7 @@ using std::unordered_map; using std::thread; using std::promise; using std::future; -using tello::Logger; +using tello::LoggerInterface; using tello::LoggerType; using std::shared_ptr; using std::vector; diff --git a/src/tello/connection/udp_listener.hpp b/src/tello/connection/udp_listener.hpp index 2ab77b8..949e333 100644 --- a/src/tello/connection/udp_listener.hpp +++ b/src/tello/connection/udp_listener.hpp @@ -4,7 +4,7 @@ #include #include #include -#include "tello/logger/logger.hpp" +#include "tello/logger/logger_interface.hpp" #include "tello/native/network_interface.hpp" #include #include @@ -15,7 +15,7 @@ using std::unordered_map; using std::thread; using std::promise; using std::future; -using tello::Logger; +using tello::LoggerInterface; using tello::LoggerType; using std::shared_ptr; @@ -56,12 +56,12 @@ namespace tello { connectionMutex.unlock_shared(); continue; } else if (isFirstAccessToFileDescriptor) { - Logger::get(loggerType)->info(string("Start listen to port {0:d}"), - connectionData._networkData._port); + LoggerInterface::info(loggerType, string("Start listen to port {}"), + std::to_string(connectionData._networkData._port)); isFirstAccessToFileDescriptor = false; } - NetworkResponse& networkResponse = networkInterface->read(connectionData._fileDescriptor); + NetworkResponse networkResponse = networkInterface->read(connectionData._fileDescriptor); connectionMutex.unlock_shared(); telloMappingMutex.lock_shared(); @@ -70,14 +70,14 @@ namespace tello { if (telloIt != telloMapping.end()) { invoke(networkResponse, telloIt->second); } else if (networkResponse._length > 0) { - Logger::get(loggerType)->warn(string("Received data {0} from unknown Tello {1:x}"), - networkResponse.response(), networkResponse._sender._ip); + LoggerInterface::warn(loggerType, string("Received data {0} from unknown Tello {1}"), + networkResponse.response(), std::to_string(networkResponse._sender._ip)); } telloMappingMutex.unlock_shared(); } - Logger::get(loggerType)->info(string("Stop listen to port {0:d}"), - connectionData._networkData._port); + LoggerInterface::info(loggerType, string("Stop listen to port {0}"), + std::to_string(connectionData._networkData._port)); } }; } \ No newline at end of file diff --git a/src/tello/logger/CMakeLists.txt b/src/tello/logger/CMakeLists.txt index e3d3266..f04258e 100644 --- a/src/tello/logger/CMakeLists.txt +++ b/src/tello/logger/CMakeLists.txt @@ -1,3 +1,7 @@ target_sources(${PROJECT_NAME} PUBLIC - ${TELLO_INCLUDE}/tello/logger/logger.hpp + ${TELLO_INCLUDE}/tello/logger/logger_interface.hpp + + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/logger_interface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/logger.hpp ${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp) \ No newline at end of file diff --git a/src/tello/logger/logger.cpp b/src/tello/logger/logger.cpp index dcbe09c..23468ef 100644 --- a/src/tello/logger/logger.cpp +++ b/src/tello/logger/logger.cpp @@ -1,15 +1,12 @@ -#include +#include "logger.hpp" +#include #include +#include std::shared_ptr tello::Logger::_commandLogger = spdlog::basic_logger_mt("command_logger_init", "./log/command_log_init.log"); std::shared_ptr tello::Logger::_statusLogger = spdlog::basic_logger_mt("status_logger_init", "./log/status_log_init.log"); std::shared_ptr tello::Logger::_videoLogger = spdlog::basic_logger_mt("video_logger_init", "./log/video_log_init.log"); -tello::LoggerSettings::LoggerSettings(string commandFileLocation, string videoFileLocation, - string statusFileLocation) : _commandFileLocation(std::move(commandFileLocation)), - _videoFileLocation(std::move(videoFileLocation)), - _statusFileLocation(std::move(statusFileLocation)) {} - void tello::Logger::initialize(const tello::LoggerSettings& settings) { _commandLogger = spdlog::basic_logger_mt("command_logger", settings._commandFileLocation); _videoLogger = spdlog::basic_logger_mt("video_logger", settings._videoFileLocation); @@ -19,14 +16,23 @@ void tello::Logger::initialize(const tello::LoggerSettings& settings) { _statusLogger->flush_on(spdlog::level::err); } -std::shared_ptr tello::Logger::get(const tello::LoggerType& loggerType) { - if (_commandLogger == nullptr || _videoLogger == nullptr || _statusLogger == nullptr) { - _commandLogger = spdlog::basic_logger_mt("command_logger_temp", "./log/command_log_temp.log"); - _videoLogger = spdlog::basic_logger_mt("video_logger_temp", "./log/video_log_temp.log"); - _statusLogger = spdlog::basic_logger_mt("status_logger_temp", "./log/status_log_temp.log"); - } +void tello::Logger::info(const LoggerType& loggerType, const string& message, const string& params...) { + auto logger = tello::Logger::logger(loggerType); + logger->info(message, params); +} + +void tello::Logger::error(const LoggerType& loggerType, const string& message, const string& params...) { + auto logger = tello::Logger::logger(loggerType); + logger->error(message, params); +} + +void tello::Logger::warn(const LoggerType& loggerType, const string& message, const string& params...) { + auto logger = tello::Logger::logger(loggerType); + logger->warn(message, params); +} +std::shared_ptr tello::Logger::logger(const LoggerType& loggerType) { switch (loggerType) { case LoggerType::STATUS : return _statusLogger; diff --git a/src/tello/logger/logger.hpp b/src/tello/logger/logger.hpp new file mode 100644 index 0000000..595c7bd --- /dev/null +++ b/src/tello/logger/logger.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include +#include + +using std::string; + +namespace spdlog { + class logger; +} + +using spdlog::logger; + +namespace tello { + + enum class LoggerType; + class LoggerSettings; + + class Logger { + public: + Logger() = delete; + + static void info(const LoggerType& loggerType, const string& message, const string& params...); + static void error(const LoggerType& loggerType, const string& message, const string& params...); + static void warn(const LoggerType& loggerType, const string& message, const string& params...); + static void initialize(const LoggerSettings& settings); + + private: + static std::shared_ptr _commandLogger; + static std::shared_ptr _videoLogger; + static std::shared_ptr _statusLogger; + + static std::shared_ptr logger(const LoggerType& loggerType); + }; +} \ No newline at end of file diff --git a/src/tello/logger/logger_interface.cpp b/src/tello/logger/logger_interface.cpp new file mode 100644 index 0000000..ec8b29c --- /dev/null +++ b/src/tello/logger/logger_interface.cpp @@ -0,0 +1,29 @@ +#include + +#include "logger.hpp" +#include + +using tello::Logger; + +tello::LoggerSettings::LoggerSettings(string commandFileLocation, string videoFileLocation, + string statusFileLocation) : _commandFileLocation(std::move(commandFileLocation)), + _videoFileLocation(std::move(videoFileLocation)), + _statusFileLocation(std::move(statusFileLocation)) { + +} + +void tello::LoggerInterface::info(const LoggerType& loggerType, const string& message, const string& params...) { + Logger::info(loggerType, message, params); +} + +void tello::LoggerInterface::error(const LoggerType& loggerType, const string& message, const string& params...) { + Logger::error(loggerType, message, params); +} + +void tello::LoggerInterface::warn(const LoggerType& loggerType, const string& message, const string& params...) { + Logger::warn(loggerType, message, params); +} + +void tello::LoggerInterface::initialize(const LoggerSettings& settings) { + Logger::initialize(settings); +} \ No newline at end of file diff --git a/src/tello/native/tello_network.cpp b/src/tello/native/tello_network.cpp index 1663c19..bbd66d0 100644 --- a/src/tello/native/tello_network.cpp +++ b/src/tello/native/tello_network.cpp @@ -1,5 +1,7 @@ #include "tello/native/network_interface.hpp" +#include + tello::NetworkData::NetworkData(const tello::SIN_FAM sinFam, const unsigned short port, const ip_address ip) : _sinFam(sinFam), _port(port), diff --git a/src/tello/native/windows/network_impl.cpp b/src/tello/native/windows/network_impl.cpp index 26e2b3f..dae0316 100644 --- a/src/tello/native/windows/network_impl.cpp +++ b/src/tello/native/windows/network_impl.cpp @@ -1,12 +1,12 @@ #include "network_impl.hpp" -#include +#include #define BUFFER_LENGTH 2048 using tello::NetworkData; using tello::NetworkResponse; using tello::LoggerType; -using tello::Logger; +using tello::LoggerInterface; using tello::SIN_FAM; using tello::ConnectionData; @@ -20,7 +20,7 @@ optional tello::windows::NetworkImpl::connect(const NetworkData& if (!_initializedConnection) { int result = WSAStartup(MAKEWORD(2, 2), &_wsaData); if (result != 0) { - Logger::get(logger)->info(string("Cannot initialize windows socket")); + LoggerInterface::info(logger, string("Cannot initialize windows socket"), ""); return std::nullopt; } _initializedConnection = true; @@ -31,8 +31,8 @@ optional tello::windows::NetworkImpl::connect(const NetworkData& memset(&servaddr, 0, sizeof(servaddr)); if ((fileDescriptor = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - Logger::get(LoggerType::COMMAND)->error( - std::string("Socket creation failed. Port {0:d}"), data._port); + LoggerInterface::error(LoggerType::COMMAND, + std::string("Socket creation failed. Port {0}"), std::to_string(data._port)); return std::nullopt; } @@ -41,8 +41,8 @@ optional tello::windows::NetworkImpl::connect(const NetworkData& servaddr.sin_port = htons(data._port); if (bind(fileDescriptor, (const struct sockaddr*) &servaddr, sizeof(servaddr)) < 0) { - Logger::get(logger)->error( - string("Bind failed. Port {0:d}"), data._port); + LoggerInterface::error(logger, + string("Bind failed. Port {0}"), std::to_string(data._port)); closesocket(fileDescriptor); return std::nullopt; } @@ -70,8 +70,8 @@ bool tello::windows::NetworkImpl::setTimeout(const int& fileDescriptor, const un (const char*) &timeoutD, sizeof(DWORD) ) < 0) { - Logger::get(logger)->error( - std::string("Cannot set receive timeout of {0:d}"), timeout); + LoggerInterface::error(logger, + std::string("Cannot set receive timeout of {}"), std::to_string(timeout)); return false; } return true; diff --git a/src/tello/response/query_response.cpp b/src/tello/response/query_response.cpp index 1153093..195a374 100644 --- a/src/tello/response/query_response.cpp +++ b/src/tello/response/query_response.cpp @@ -1,7 +1,7 @@ #include -#include +#include -using tello::Logger; +using tello::LoggerInterface; using tello::LoggerType; tello::QueryResponse::QueryResponse(const Status& status) : Response(status), @@ -22,18 +22,18 @@ int tello::QueryResponse::QueryResponse::convert(const string& stringValue) { } catch (const std::invalid_argument& ia) { - Logger::get(LoggerType::COMMAND)->error(string("Cannot parse query - 'invalid arg' [{}]"), stringValue); + LoggerInterface::error(LoggerType::COMMAND, string("Cannot parse query - 'invalid arg' [{}]"), stringValue); return -1; } catch (const std::out_of_range& oor) { - Logger::get(LoggerType::COMMAND)->error(string("Cannot parse query - 'out of range' [{}]"), stringValue); + LoggerInterface::error(LoggerType::COMMAND, string("Cannot parse query - 'out of range' [{}]"), stringValue); return -2; } catch (...) { - Logger::get(LoggerType::COMMAND)->error(string("Cannot parse query - 'exception' [{}]"), stringValue); + LoggerInterface::error(LoggerType::COMMAND, string("Cannot parse query - 'exception' [{}]"), stringValue); return -3; } } \ No newline at end of file diff --git a/src/tello/response/video_response.cpp b/src/tello/response/video_response.cpp index 8fc72e0..98f28b7 100644 --- a/src/tello/response/video_response.cpp +++ b/src/tello/response/video_response.cpp @@ -1,5 +1,7 @@ #include +#include + tello::VideoResponse::VideoResponse(unsigned char* videoFrame, unsigned int length) : Response(Status::OK), _videoFrame(reinterpret_cast(std::memcpy(new unsigned char[length], videoFrame, length))), diff --git a/src/tello/tello.cpp b/src/tello/tello.cpp index 267e1e6..8e2e8eb 100644 --- a/src/tello/tello.cpp +++ b/src/tello/tello.cpp @@ -26,7 +26,7 @@ using tello::Response; using tello::ConnectionData; -using tello::Logger; +using tello::LoggerInterface; using tello::Status; using namespace tello::command; diff --git a/src/tello/video_analyzer.cpp b/src/tello/video_analyzer.cpp index 3ae0c05..1c87b45 100644 --- a/src/tello/video_analyzer.cpp +++ b/src/tello/video_analyzer.cpp @@ -1,5 +1,5 @@ #include "tello/video_analyzer.hpp" -#include "tello/logger/logger.hpp" +#include "tello/logger/logger_interface.hpp" #include #include diff --git a/test/src/shared_linking_test/src/environment.cpp b/test/src/shared_linking_test/src/environment.cpp index 3be22b3..41aa524 100644 --- a/test/src/shared_linking_test/src/environment.cpp +++ b/test/src/shared_linking_test/src/environment.cpp @@ -1,9 +1,9 @@ #include "environment.hpp" -#include +#include #include using tello::LoggerSettings; -using tello::Logger; +using tello::LoggerInterface; using tello::TelloNetwork; tello::Environment::~Environment() { @@ -11,7 +11,7 @@ tello::Environment::~Environment() { void tello::Environment::Environment::SetUp() { LoggerSettings settings {"./log/command_log.log", "./log/video_log.log", "./log/status_log.log"}; - Logger::initialize(settings); + LoggerInterface::initialize(settings); const bool isConnected = TelloNetwork::connect(); assert(isConnected); diff --git a/test/src/shared_linking_test/src/shared_linking_test.cpp b/test/src/shared_linking_test/src/shared_linking_test.cpp index 73bcf75..f880483 100644 --- a/test/src/shared_linking_test/src/shared_linking_test.cpp +++ b/test/src/shared_linking_test/src/shared_linking_test.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #define TELLO_IP_ADDRESS (ip_address)0xC0A80A01 // 192.168.10.1 #define TELLO1_IP_ADDRESS (ip_address)0xC0A80A01 // 192.168.10.1 @@ -20,7 +20,7 @@ using std::promise; using std::future; using tello::QueryResponse; using tello::Swarm; -using tello::Logger; +using tello::LoggerInterface; using tello::LoggerType; TEST(SHARED_TEST, BasicFlightCommands) { @@ -147,12 +147,12 @@ TEST(SHARED_TEST, SimpleCaseBergerStatus) { } void handler(const VideoResponse& response) { - Logger::get(LoggerType::VIDEO)->info("VIDEO: {}", - std::to_string(response.length())); + LoggerInterface::info(LoggerType::VIDEO, "VIDEO: {}", + std::to_string(response.length())); handlerCallCount++; } void statusHandler(const StatusResponse& response) { - Logger::get(LoggerType::STATUS)->info("STATUS: {}", std::to_string(response.get_agx())); + LoggerInterface::info(LoggerType::STATUS, "STATUS: {}", std::to_string(response.get_agx())); statusHandlerCallCount++; } \ No newline at end of file diff --git a/test/src/tello/environment.cpp b/test/src/tello/environment.cpp index 3be22b3..41aa524 100644 --- a/test/src/tello/environment.cpp +++ b/test/src/tello/environment.cpp @@ -1,9 +1,9 @@ #include "environment.hpp" -#include +#include #include using tello::LoggerSettings; -using tello::Logger; +using tello::LoggerInterface; using tello::TelloNetwork; tello::Environment::~Environment() { @@ -11,7 +11,7 @@ tello::Environment::~Environment() { void tello::Environment::Environment::SetUp() { LoggerSettings settings {"./log/command_log.log", "./log/video_log.log", "./log/status_log.log"}; - Logger::initialize(settings); + LoggerInterface::initialize(settings); const bool isConnected = TelloNetwork::connect(); assert(isConnected); diff --git a/test/src/tello/video_test.cpp b/test/src/tello/video_test.cpp index 2a7ef1b..7cb90f5 100644 --- a/test/src/tello/video_test.cpp +++ b/test/src/tello/video_test.cpp @@ -2,14 +2,14 @@ #include #include #include -#include +#include #define TELLO_IP_ADDRESS (ip_address)0xC0A80A01 // 192.168.10.1 using tello::Tello; using tello::Response; using tello::Status; -using tello::Logger; +using tello::LoggerInterface; using tello::LoggerType; using std::string; @@ -39,7 +39,7 @@ TEST(Tello, SimpleCaseBergerVideo) { } void handler(const VideoResponse& response) { - Logger::get(LoggerType::VIDEO)->info("VIDEO: {}", + LoggerInterface::info(LoggerType::VIDEO, "VIDEO: {}", std::string(reinterpret_cast(response.videoFrame()), response.length())); handlerCallCount++;