summaryrefslogtreecommitdiffstats
path: root/src/lib/database/db_log.cc
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2021-02-22 12:47:30 +0100
committerAndrei Pavel <andrei@isc.org>2021-03-08 16:16:36 +0100
commit5a69c4c6669d5cb9c88e297fe1f0c4b7ca5a37cf (patch)
tree5f07b7dc9b7f4e8c7995c7b37bae30f042f26222 /src/lib/database/db_log.cc
parent[#1728] bump up kea version (diff)
downloadkea-5a69c4c6669d5cb9c88e297fe1f0c4b7ca5a37cf.tar.xz
kea-5a69c4c6669d5cb9c88e297fe1f0c4b7ca5a37cf.zip
[#1719] convert DB_LOG macros to structs
Diffstat (limited to 'src/lib/database/db_log.cc')
-rw-r--r--src/lib/database/db_log.cc71
1 files changed, 71 insertions, 0 deletions
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<fatal>::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<error>::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<warn>::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<info>::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<debug>::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<fatal>::isEnabled(int const /* debug_level = 0 */) const {
+ return db_logger_stack.back().logger_.isFatalEnabled();
+}
+
+template <>
+bool
+DB_LOG<error>::isEnabled(int const /* debug_level = 0 */) const {
+ return db_logger_stack.back().logger_.isErrorEnabled();
+}
+
+template <>
+bool
+DB_LOG<warn>::isEnabled(int const /* debug_level = 0 */) const {
+ return db_logger_stack.back().logger_.isWarnEnabled();
+}
+
+template <>
+bool
+DB_LOG<info>::isEnabled(int const /* debug_level = 0 */) const {
+ return db_logger_stack.back().logger_.isInfoEnabled();
+}
+
+template <>
+bool
+DB_LOG<debug>::isEnabled(int const debug_level /* = 0 */) const {
+ return db_logger_stack.back().logger_.isDebugEnabled(debug_level);
+}
+
} // namespace db
} // namespace isc