diff options
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r-- | arm_compute/core/utils/logging/LoggerRegistry.h | 14 | ||||
-rw-r--r-- | arm_compute/core/utils/logging/Macros.h | 51 |
2 files changed, 35 insertions, 30 deletions
diff --git a/arm_compute/core/utils/logging/LoggerRegistry.h b/arm_compute/core/utils/logging/LoggerRegistry.h index d861476fea..d3c691139e 100644 --- a/arm_compute/core/utils/logging/LoggerRegistry.h +++ b/arm_compute/core/utils/logging/LoggerRegistry.h @@ -51,10 +51,11 @@ public: * @note Some names are reserved e.g. [CORE, RUNTIME, GRAPH] * * @param[in] name Logger's name - * @param[in] log_level Logger's log level - * @param[in] printers Printers to attach to the system loggers + * @param[in] log_level Logger's log level. Defaults to @ref LogLevel::INFO + * @param[in] printers Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ - void create_logger(const std::string &name, LogLevel log_level, std::vector<std::shared_ptr<Printer>> printers = {}); + void create_logger(const std::string &name, LogLevel log_level = LogLevel::INFO, + std::vector<std::shared_ptr<Printer>> printers = { std::make_shared<StdPrinter>() }); /** Remove a logger * * @param name Logger's name @@ -69,10 +70,11 @@ public: std::shared_ptr<Logger> logger(const std::string &name); /** Creates reserved library loggers * - * @param[in] log_level Logger's log level - * @param[in] printers Printers to attach to the system loggers + * @param[in] log_level (Optional) Logger's log level. Defaults to @ref LogLevel::INFO + * @param[in] printers (Optional) Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ - void create_reserved_loggers(LogLevel log_level, std::vector<std::shared_ptr<Printer>> printers = {}); + void create_reserved_loggers(LogLevel log_level = LogLevel::INFO, + std::vector<std::shared_ptr<Printer>> printers = { std::make_shared<StdPrinter>() }); private: /** Default constructor */ diff --git a/arm_compute/core/utils/logging/Macros.h b/arm_compute/core/utils/logging/Macros.h index b17354bed7..bc121e25eb 100644 --- a/arm_compute/core/utils/logging/Macros.h +++ b/arm_compute/core/utils/logging/Macros.h @@ -30,32 +30,35 @@ #ifdef ARM_COMPUTE_LOGGING_ENABLED -#define ARM_COMPUTE_LOG_MSG(logger_name, log_level, msg) \ - { \ - auto logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(logger != nullptr) \ - { \ - logger->log(log_level, msg); \ - } \ - } +#define ARM_COMPUTE_LOG_MSG(logger_name, log_level, msg) \ + do \ + { \ + auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ + if(__logger != nullptr) \ + { \ + __logger->log(log_level, msg); \ + } \ + } while(false) -#define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ - { \ - auto logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(logger != nullptr) \ - { \ - logger->log(log_level, fmt, __VA_ARGS__); \ - } \ - } +#define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ + do \ + { \ + auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ + if(__logger != nullptr) \ + { \ + __logger->log(log_level, fmt, __VA_ARGS__); \ + } \ + } while(false) -#define ARM_COMPUTE_LOG_STREAM(logger_name, log_level, stream) \ - { \ - auto logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(logger != nullptr) \ - { \ - logger->log(log_level, static_cast<std::ostringstream &>(std::ostringstream() << stream).str()); \ - } \ - } +#define ARM_COMPUTE_LOG_STREAM(logger_name, log_level, stream) \ + do \ + { \ + auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ + if(__logger != nullptr) \ + { \ + __logger->log(log_level, static_cast<std::ostringstream &>(std::ostringstream() << stream).str()); \ + } \ + } while(false) #else /* ARM_COMPUTE_LOGGING_ENABLED */ |