Commit 8aaf38b8 authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3198] Addressed review comments.

- Enabled log messages in user_chk
- Fixed a typo
parent 8bafeba4
......@@ -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);
......
// 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 <dhcp/pkt6.h>
#include <dhcpsrv/subnet.h>
#include <user_chk.h>
#include <user_chk_log.h>
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);
}
......
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment