From 5a69c4c6669d5cb9c88e297fe1f0c4b7ca5a37cf Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Mon, 22 Feb 2021 13:47:30 +0200 Subject: [#1719] convert DB_LOG macros to structs --- src/lib/database/db_log.cc | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'src/lib/database/db_log.cc') diff --git a/src/lib/database/db_log.cc b/src/lib/database/db_log.cc index b241cd482d..68083cc924 100644 --- a/src/lib/database/db_log.cc +++ b/src/lib/database/db_log.cc @@ -65,5 +65,76 @@ void checkDbLoggerStack() { } } +template <> +isc::log::Logger::Formatter +DB_LOG::formatter(DbMessageID const message_id, + int const /* debug_level = 0 */) { + return isc::db::db_logger_stack.back().logger_.fatal( + isc::db::db_logger_stack.back().translateMessage(message_id)); +} + +template <> +isc::log::Logger::Formatter +DB_LOG::formatter(DbMessageID const message_id, + int const /* debug_level = 0 */) { + return isc::db::db_logger_stack.back().logger_.error( + isc::db::db_logger_stack.back().translateMessage(message_id)); +} + +template <> +isc::log::Logger::Formatter +DB_LOG::formatter(DbMessageID const message_id, + int const /* debug_level = 0 */) { + return isc::db::db_logger_stack.back().logger_.warn( + isc::db::db_logger_stack.back().translateMessage(message_id)); +} + +template <> +isc::log::Logger::Formatter +DB_LOG::formatter(DbMessageID const message_id, + int const /* debug_level = 0 */) { + return isc::db::db_logger_stack.back().logger_.info( + isc::db::db_logger_stack.back().translateMessage(message_id)); +} + +template <> +isc::log::Logger::Formatter +DB_LOG::formatter(DbMessageID const message_id, + int const debug_level /* = 0 */) { + return isc::db::db_logger_stack.back().logger_.debug( + debug_level, + isc::db::db_logger_stack.back().translateMessage(message_id)); +} + +template <> +bool +DB_LOG::isEnabled(int const /* debug_level = 0 */) const { + return db_logger_stack.back().logger_.isFatalEnabled(); +} + +template <> +bool +DB_LOG::isEnabled(int const /* debug_level = 0 */) const { + return db_logger_stack.back().logger_.isErrorEnabled(); +} + +template <> +bool +DB_LOG::isEnabled(int const /* debug_level = 0 */) const { + return db_logger_stack.back().logger_.isWarnEnabled(); +} + +template <> +bool +DB_LOG::isEnabled(int const /* debug_level = 0 */) const { + return db_logger_stack.back().logger_.isInfoEnabled(); +} + +template <> +bool +DB_LOG::isEnabled(int const debug_level /* = 0 */) const { + return db_logger_stack.back().logger_.isDebugEnabled(debug_level); +} + } // namespace db } // namespace isc -- cgit v1.2.3