diff options
author | neodarz <neodarz@neodarz.net> | 2020-08-13 08:09:10 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2020-08-13 08:09:10 +0200 |
commit | 9acb4a5135db19d7086bb93cf5ca64f83f0806cb (patch) | |
tree | 13f65419fa2a0c58e3a26d2e281cf6ae654a6181 /main.cpp | |
parent | 1d3775f20177bbe7c1d9afa7c170e78f24f279e4 (diff) | |
download | umosapicpp-9acb4a5135db19d7086bb93cf5ca64f83f0806cb.tar.xz umosapicpp-9acb4a5135db19d7086bb93cf5ca64f83f0806cb.zip |
Use an external library for logging
This library has an asynchronous mode who can be useful for speed
issues.
Diffstat (limited to '')
-rw-r--r-- | main.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -4,7 +4,9 @@ #include <pwd.h> #include "clara.hpp" + #include "shared.h" +#include "logging.h" #include "config.h" #include "api/umosapi.h" @@ -43,23 +45,22 @@ int main(int argc, char *argv[]) { exit(1); } - std::cout << "INFO: Using " << std::thread::hardware_concurrency() << " cores"; - std::cout << " - " << thr << " threads" << std::endl; - std::cout << "INFO: Listen on 0.0.0.0:" << config["port"] << std::endl; + spdlog::info("Using {} cores - {} threads", std::thread::hardware_concurrency(), thr); + spdlog::info("Listen on 0.0.0.0:{}", config["port"]); - std::cout << "INFO: Using config file '" << config_path << "'" << std::endl; + spdlog::info("Using config file '{}'", config_path); if (!std::filesystem::exists(config_path)) { - std::cout << "ERROR: Error fatal : config file '" << config_path << "' not found" << std::endl; - std::cout << "ERROR: config.txt is search here: ~/.config/umosapi/config.txt" << std::endl; + spdlog::error("Error fatal: config file '{}' not found", config_path); + spdlog::error("config.txt is searched here: ~/.config/umosapi.config.txt"); exit (EXIT_FAILURE); } load_config(config_path); - std::cout << "Using swaggerui " << config["swaggerui"] << " path" << std::endl; - std::cout << "INFO: No support for swagger for the moment" << std::endl; - std::cout << "INFO: Using mongoURI " << config["mongoURI"] << std::endl; + spdlog::info("Using swaggerui {} path", config["swaggerui"]); + spdlog::warn("No support for swagger for the moment"); + spdlog::info("Using mongoURI {}", config["mongoURI"]); UmosapiService::Api umosapi; umosapi.init(); |