From: Marcin Siodelski Date: Wed, 15 Apr 2015 05:24:52 +0000 (+0200) Subject: [3198] Addressed review comments. X-Git-Tag: trac3812_base~2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8aaf38b8d48be97b2a016d7f5c747bf994246cdb;p=thirdparty%2Fkea.git [3198] Addressed review comments. - Enabled log messages in user_chk - Fixed a typo --- diff --git a/src/hooks/dhcp/user_chk/load_unload.cc b/src/hooks/dhcp/user_chk/load_unload.cc index a928b5b541..ccdd5319dc 100644 --- a/src/hooks/dhcp/user_chk/load_unload.cc +++ b/src/hooks/dhcp/user_chk/load_unload.cc @@ -99,8 +99,8 @@ int load(LibraryHandle&) { } catch (const std::exception& ex) { // Log the error and return failure. - std::cout << "DHCP UserCheckHook could not be loaded: " - << ex.what() << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_HOOK_LOAD_ERROR) + .arg(ex.what()); ret_val = 1; } @@ -121,8 +121,8 @@ int unload() { } catch (const std::exception& ex) { // On the off chance something goes awry, catch it and log it. // @todo Not sure if we should return a non-zero result or not. - std::cout << "DHCP UserCheckHook could not be unloaded: " - << ex.what() << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_HOOK_UNLOAD_ERROR) + .arg(ex.what()); } return (0); diff --git a/src/hooks/dhcp/user_chk/subnet_select_co.cc b/src/hooks/dhcp/user_chk/subnet_select_co.cc index a457265933..1c38759acc 100644 --- a/src/hooks/dhcp/user_chk/subnet_select_co.cc +++ b/src/hooks/dhcp/user_chk/subnet_select_co.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013,2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -20,6 +20,7 @@ #include #include #include +#include using namespace isc::dhcp; using namespace isc::hooks; @@ -49,8 +50,7 @@ extern "C" { /// @return 0 upon success, non-zero otherwise. int subnet4_select(CalloutHandle& handle) { if (!user_registry) { - std::cout << "DHCP UserCheckHook : subnet4_select UserRegistry is null" - << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_SUBNET4_SELECT_REGISTRY_NULL); return (1); } @@ -78,8 +78,8 @@ int subnet4_select(CalloutHandle& handle) { handle.setArgument("subnet4", subnet); } } catch (const std::exception& ex) { - std::cout << "DHCP UserCheckHook : subnet6_select unexpected error: " - << ex.what() << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_SUBNET4_SELECT_ERROR) + .arg(ex.what()); return (1); } @@ -104,8 +104,7 @@ int subnet4_select(CalloutHandle& handle) { /// @return 0 upon success, non-zero otherwise. int subnet6_select(CalloutHandle& handle) { if (!user_registry) { - std::cout << "DHCP UserCheckHook : subnet6_select UserRegistry is null" - << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_SUBNET6_SELECT_REGISTRY_NULL); return (1); } @@ -133,8 +132,8 @@ int subnet6_select(CalloutHandle& handle) { handle.setArgument("subnet6", subnet); } } catch (const std::exception& ex) { - std::cout << "DHCP UserCheckHook : subnet6_select unexpected error: " - << ex.what() << std::endl; + LOG_ERROR(user_chk_logger, USER_CHK_SUBNET6_SELECT_ERROR) + .arg(ex.what()); return (1); } diff --git a/src/lib/log/tests/message_initializer_1_unittest.cc b/src/lib/log/tests/message_initializer_1_unittest.cc index 7171a88495..bd922cfbf4 100644 --- a/src/lib/log/tests/message_initializer_1_unittest.cc +++ b/src/lib/log/tests/message_initializer_1_unittest.cc @@ -120,7 +120,7 @@ TEST(MessageInitializerTest1, dynamicLoadUnload) { EXPECT_EQ("global message nine", global->getText("GLOBAL9")); // Destroy the first initializer. The first two messages should - // be unregistsred. + // be unregistered. init1.reset(); EXPECT_TRUE(global->getText("GLOBAL7").empty()); EXPECT_TRUE(global->getText("GLOBAL8").empty());