From: Francis Dupont Date: Fri, 5 Dec 2025 14:16:30 +0000 (+0100) Subject: [#4248] Checkpoint added logger X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd95d1d8751c221364a4e0971b8e58e4bf32b82f;p=thirdparty%2Fkea.git [#4248] Checkpoint added logger --- diff --git a/src/lib/dhcp/.gitattributes b/src/lib/dhcp/.gitattributes new file mode 100644 index 0000000000..6663fc55c3 --- /dev/null +++ b/src/lib/dhcp/.gitattributes @@ -0,0 +1,2 @@ +/dhcp_messages.cc -diff merge=ours +/dhcp_messages.h -diff merge=ours diff --git a/src/lib/dhcp/dhcp_log.cc b/src/lib/dhcp/dhcp_log.cc new file mode 100644 index 0000000000..731d8a1e28 --- /dev/null +++ b/src/lib/dhcp/dhcp_log.cc @@ -0,0 +1,18 @@ +// Copyright (C) 2025 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include "dhcp/dhcp_log.h" + +namespace isc { +namespace dhcp { + +isc::log::Logger dhcp_logger("dhcp"); + +} // namespace dhcp +} // namespace isc + diff --git a/src/lib/dhcp/dhcp_log.h b/src/lib/dhcp/dhcp_log.h new file mode 100644 index 0000000000..b4f9032ba8 --- /dev/null +++ b/src/lib/dhcp/dhcp_log.h @@ -0,0 +1,26 @@ +// Copyright (C) 2025 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef DHCP_LOG_H +#define DHCP_LOG_H + +#include +#include + +namespace isc { +namespace dhcp { + +/// \brief DHCP library Logger +/// +/// Define the logger used to log messages. We could define it in multiple +/// modules, but defining in a single module and linking to it saves time and +/// space. +extern isc::log::Logger dhcp_logger; + +} // namespace dhcp +} // namespace isc + +#endif // DHCP_LOG_H diff --git a/src/lib/dhcp/dhcp_messages.cc b/src/lib/dhcp/dhcp_messages.cc new file mode 100644 index 0000000000..3180325449 --- /dev/null +++ b/src/lib/dhcp/dhcp_messages.cc @@ -0,0 +1,23 @@ +// File created from src/lib/dhcp/dhcp_messages.mes + +#include +#include +#include + +namespace isc { +namespace dhcp { + + +} // namespace dhcp +} // namespace isc + +namespace { + +const char* values[] = { + NULL +}; + +const isc::log::MessageInitializer initializer(values); + +} // Anonymous namespace + diff --git a/src/lib/dhcp/dhcp_messages.h b/src/lib/dhcp/dhcp_messages.h new file mode 100644 index 0000000000..a320114820 --- /dev/null +++ b/src/lib/dhcp/dhcp_messages.h @@ -0,0 +1,15 @@ +// File created from src/lib/dhcp/dhcp_messages.mes + +#ifndef DHCP_MESSAGES_H +#define DHCP_MESSAGES_H + +#include + +namespace isc { +namespace dhcp { + + +} // namespace dhcp +} // namespace isc + +#endif // DHCP_MESSAGES_H diff --git a/src/lib/dhcp/dhcp_messages.mes b/src/lib/dhcp/dhcp_messages.mes new file mode 100644 index 0000000000..19b6e6bd8f --- /dev/null +++ b/src/lib/dhcp/dhcp_messages.mes @@ -0,0 +1,8 @@ +# Copyright (C) 2025 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 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +$NAMESPACE isc::dhcp + diff --git a/src/lib/dhcp/meson.build b/src/lib/dhcp/meson.build index 5c32ebdf9c..2e1f710c46 100644 --- a/src/lib/dhcp/meson.build +++ b/src/lib/dhcp/meson.build @@ -13,6 +13,8 @@ endif kea_dhcp_lib = shared_library( 'kea-dhcp', 'classify.cc', + 'dhcp_log.cc', + 'dhcp_messages.cc', 'duid.cc', 'duid_factory.cc', 'hwaddr.cc', @@ -69,6 +71,8 @@ kea_dhcp_headers = [ 'classify.h', 'dhcp4.h', 'dhcp6.h', + 'dhcp_log.h', + 'dhcp_messages.h', 'docsis3_option_defs.h', 'duid.h', 'duid_factory.h', @@ -123,3 +127,17 @@ kea_dhcp_headers = [ 'std_option_defs.h', ] install_headers(kea_dhcp_headers, preserve_path: true, subdir: 'kea/dhcp') + +if KEA_MSG_COMPILER.found() + current_source_dir = meson.current_source_dir() + target_gen_messages = run_target( + 'src-lib-dhcp-dhcp_messages', + command: [ + CD_AND_RUN, + TOP_SOURCE_DIR, + KEA_MSG_COMPILER, + 'src/lib/dhcp/dhcp_messages.mes', + ], + ) + TARGETS_GEN_MESSAGES += [target_gen_messages] +endif