]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2425] Fixed no logger check code and test
authorFrancis Dupont <fdupont@isc.org>
Wed, 25 May 2022 13:49:35 +0000 (15:49 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 30 May 2022 14:49:33 +0000 (14:49 +0000)
src/lib/log/log_formatter.cc
src/lib/log/tests/log_formatter_unittest.cc

index 994dfbc7fbab487c777862ad71d0eee67318f3cc..1ce33f413eeae9dbb2b4a4854f2d09026849d5af 100644 (file)
@@ -37,7 +37,7 @@ replacePlaceholder(std::string& message, const string& arg,
                                                                          << message << "'");
 #else
         // We're missing the placeholder, so add some complain
-        message.append(" @@Missing placeholder '" + mark + "' for value '" + arg + "'@@");
+        message.append(" @@Missing logger placeholder '" + mark + "' for value '" + arg + "'@@");
 #endif /* ENABLE_LOGGER_CHECKS */
     }
 }
@@ -59,7 +59,7 @@ checkExcessPlaceholders(std::string& message,
              << "'." << endl;
         assert(false);
 #else
-        message.append(" @@Excess logger placeholder " + mark + " still exists@@");
+        message.append(" @@Excess logger placeholder '" + mark + "' still exists@@");
 #endif /* ENABLE_LOGGER_CHECKS */
     }
 }
index c0cf8abd7b39ff7f0b5195bc88f3ca8413c8ed88..4bd0405650f78f46a5b8cc5381f4f18a035af12c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2022 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -136,7 +136,8 @@ TEST_F(FormatterTest, mismatchedPlaceholders) {
     ASSERT_EQ(1, outputs.size());
     EXPECT_EQ(isc::log::INFO, outputs[0].first);
     EXPECT_EQ("Missing the second argument "
-              "@@Missing placeholder %2 for 'missing'@@", outputs[0].second);
+              "@@Missing logger placeholder '%2' for value 'missing'@@",
+              outputs[0].second);
 
     EXPECT_NO_THROW(Formatter(isc::log::INFO,
                               s("Too many arguments in %1 %2"), this).
@@ -144,7 +145,7 @@ TEST_F(FormatterTest, mismatchedPlaceholders) {
     ASSERT_EQ(2, outputs.size());
     EXPECT_EQ(isc::log::INFO, outputs[1].first);
     EXPECT_EQ("Too many arguments in only one %2 "
-              "@@Excess logger placeholders still exist@@",
+              "@@Excess logger placeholder '%2' still exists@@",
               outputs[1].second);
 
     EXPECT_NO_THROW(Formatter(isc::log::INFO, s("Missing the first %2"), this).
@@ -152,7 +153,8 @@ TEST_F(FormatterTest, mismatchedPlaceholders) {
     ASSERT_EQ(3, outputs.size());
     EXPECT_EQ(isc::log::INFO, outputs[2].first);
     EXPECT_EQ("Missing the first argument "
-              "@@Missing placeholder %1 for 'missing'@@", outputs[2].second);
+              "@@Missing logger placeholder '%1' for value 'missing'@@",
+              outputs[2].second);
 }
 
 #endif /* ENABLE_LOGGER_CHECKS */