Kea 3.1.5
log_utils.h
Go to the documentation of this file.
1// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef TEST_LOG_UTILS_H
8#define TEST_LOG_UTILS_H
9
10#include <string>
11#include <fstream>
12
13#include <log/logger_manager.h>
14#include <log/logger_name.h>
15#include <log/logger_support.h>
16
17#include <gtest/gtest.h>
18
19using namespace std;
20using namespace isc::log;
21
22namespace isc {
23namespace dhcp {
24namespace test {
25
35
36class LogContentTest : public ::testing::Test {
37public:
38
46
47 virtual ~LogContentTest();
48
57 bool checkFile();
58
64 size_t countFile(const string& exp_string);
65
67 void remFile();
68
70 void reset();
71
77 void logCheckVerbose(bool talk_a_lot) {
78 verbose_ = talk_a_lot;
79 }
80
84 void addString(const string& new_string);
85
91 void addString(const string& logger_msg, const string& new_string, const string& label);
92
93 vector<string> exp_strings_;
94 static const char* LOG_FILE;
95 static const char* KEA_LOG_CHECK_VERBOSE;
96
106};
107
108} // end of isc::dhcp::test namespace
109} // end of isc::dhcp namespace
110} // end of isc namespace
111#endif // TEST_LOG_UTILS_H
LogContentTest()
Initializes the logger setup for using in checking log statements.
Definition log_utils.cc:17
void reset()
reset the logger to INFO stdout.
Definition log_utils.cc:48
bool verbose_
controls whether the checkFile() should print more details.
Definition log_utils.h:105
bool checkFile()
check that the requested strings are in the test log file in the requested order.
Definition log_utils.cc:61
static const char * KEA_LOG_CHECK_VERBOSE
Definition log_utils.h:95
void remFile()
remove the test log file
Definition log_utils.cc:126
void logCheckVerbose(bool talk_a_lot)
Enables or disables verbose mode.
Definition log_utils.h:77
vector< string > exp_strings_
Definition log_utils.h:93
static const char * LOG_FILE
Definition log_utils.h:94
size_t countFile(const string &exp_string)
check that the requested string is in the test log file.
Definition log_utils.cc:97
void addString(const string &new_string)
Add a string to the vector of expected strings.
Definition log_utils.cc:130
Logging initialization functions.
Defines the logger used by the top-level component of kea-lfc.