16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LOGGER_LOGGER_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LOGGER_LOGGER_H_ 37 #define ACSDK_STRINGIFY_INNER(expression) #expression 44 #define ACSDK_STRINGIFY(macro) ACSDK_STRINGIFY_INNER(macro) 52 #define ACSDK_CONCATENATE_INNER(lhs, rhs) lhs##rhs 60 #define ACSDK_CONCATENATE(lhs, rhs) ACSDK_CONCATENATE_INNER(lhs, rhs) 207 std::chrono::system_clock::time_point time,
208 const char* threadMoniker,
248 void notifyObserversOnLogLevelChanged();
251 std::vector<LogLevelObserverInterface*> m_observers;
254 std::mutex m_observersMutex;
266 #define ACSDK_GET_LOGGER_FUNCTION_NAME(type) ACSDK_CONCATENATE(ACSDK_CONCATENATE(get, type), Logger) 280 #ifndef ACSDK_LOG_MODULE 281 #define ACSDK_LOG_MODULE ConsoleLogger 282 #endif // ACSDK_LOG_MODULE 287 namespace avsCommon {
296 #define ACSDK_GET_LOGGER_FUNCTION ACSDK_GET_LOGGER_FUNCTION_NAME(ACSDK_LOG_MODULE) 302 static std::shared_ptr<ModuleLogger> moduleLogger =
321 #ifdef ACSDK_LOG_ENABLED 322 #define ACSDK_LOG(level, entry) \ 324 auto loggerInstance = alexaClientSDK::avsCommon::utils::logger::ACSDK_GET_LOGGER_FUNCTION(); \ 325 if (loggerInstance->shouldLog(level)) { \ 326 loggerInstance->log(level, entry); \ 329 #else // ACSDK_LOG_ENABLED 330 #define ACSDK_LOG(level, entry) \ 332 (void)sizeof(level); \ 333 (void)sizeof(entry); \ 335 #endif // ACSDK_LOG_ENABLED 347 #ifdef ACSDK_DEBUG_LOG_ENABLED 348 #define ACSDK_DEBUG_LOG(level, entry) ACSDK_LOG((level), (entry)) 349 #else // ACSDK_DEBUG_LOG_ENABLED 350 #define ACSDK_DEBUG_LOG(level, entry) \ 352 (void)sizeof(level); \ 353 (void)sizeof(entry); \ 355 #endif // ACSDK_DEBUG_LOG_ENABLED 364 #define ACSDK_DEBUG9(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG9, entry) 373 #define ACSDK_DEBUG8(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG8, entry) 382 #define ACSDK_DEBUG7(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG7, entry) 391 #define ACSDK_DEBUG6(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG6, entry) 400 #define ACSDK_DEBUG5(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG5, entry) 409 #define ACSDK_DEBUG4(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG4, entry) 418 #define ACSDK_DEBUG3(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG3, entry) 427 #define ACSDK_DEBUG2(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG2, entry) 436 #define ACSDK_DEBUG1(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG1, entry) 445 #define ACSDK_DEBUG0(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG0, entry) 454 #define ACSDK_DEBUG(entry) ACSDK_DEBUG_LOG(alexaClientSDK::avsCommon::utils::logger::Level::DEBUG0, entry) 463 #define ACSDK_INFO(entry) ACSDK_LOG(alexaClientSDK::avsCommon::utils::logger::Level::INFO, entry) 472 #define ACSDK_WARN(entry) ACSDK_LOG(alexaClientSDK::avsCommon::utils::logger::Level::WARN, entry) 481 #define ACSDK_ERROR(entry) ACSDK_LOG(alexaClientSDK::avsCommon::utils::logger::Level::ERROR, entry) 489 #define ACSDK_CRITICAL(entry) ACSDK_LOG(alexaClientSDK::avsCommon::utils::logger::Level::CRITICAL, entry) 491 #ifndef ACSDK_LOGS_KEEP_FUNC_MACRO 495 #endif // ACSDK_LOGS_KEEP_FUNC_MACRO 497 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LOGGER_LOGGER_H_ Definition: ConfigurationNode.h:71
#define ACSDK_STRINGIFY(macro)
Definition: Logger.h:44
Level
Definition: Level.h:30
bool shouldLog(Level level) const
Definition: Logger.h:257
void log(Level level, const LogEntry &entry)
virtual void emit(Level level, std::chrono::system_clock::time_point time, const char *threadMoniker, const char *text)
std::shared_ptr< Logger > getConsoleLogger()
virtual ~Logger()=default
Destructor.
void init(const configuration::ConfigurationNode configuration)
Definition: LogLevelObserverInterface.h:30
void logAtExit(Level level, const LogEntry &entry)
std::shared_ptr< Logger > ACSDK_GET_LOGGER_FUNCTION()
Definition: Logger.h:301
void addLogLevelObserver(LogLevelObserverInterface *observer)
void removeLogLevelObserver(LogLevelObserverInterface *observer)
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
virtual void setLevel(Level level)
std::atomic< Level > m_level
The lowest severity level of logs to be output by this Logger.
Definition: Logger.h:234
#define ACSDK_LOG_MODULE
Definition: Logger.h:281
LogEntry is used to compile the log entry text to log via Logger.
Definition: LogEntry.h:33