Kea 2.7.6
log_utils.h
Go to the documentation of this file.
1// Copyright (C) 2016-2024 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 <config.h>
14
15#include <log/logger_manager.h>
16#include <log/logger_name.h>
17#include <log/logger_support.h>
18
19//#include <boost/shared_ptr.hpp>
20//#include <boost/scoped_ptr.hpp>
21#include <gtest/gtest.h>
22
23using namespace std;
24using namespace isc::log;
25
26namespace isc {
27namespace dhcp {
28namespace test {
29
39
40class LogContentTest : public ::testing::Test {
41public:
42
50
51 virtual ~LogContentTest();
52
61 bool checkFile();
62
68 size_t countFile(const string& exp_string);
69
71 void remFile();
72
78 void logCheckVerbose(bool talk_a_lot) {
79 verbose_ = talk_a_lot;
80 }
81
85 void addString(const string& new_string);
86
92 void addString(const string& logger_msg, const string& new_string, const string& label);
93
94 vector<string> exp_strings_;
95 static const char* LOG_FILE;
96 static const char* KEA_LOG_CHECK_VERBOSE;
97
107};
108
109} // end of isc::dhcp::test namespace
110} // end of isc::dhcp namespace
111} // end of isc namespace
112#endif // TEST_LOG_UTILS_H
Test class for testing things that emit log entries.
Definition log_utils.h:40
LogContentTest()
Initializes the logger setup for using in checking log statements.
Definition log_utils.cc:17
bool verbose_
controls whether the checkFile() should print more details.
Definition log_utils.h:106
bool checkFile()
check that the requested strings are in the test log file in the requested order.
Definition log_utils.cc:48
static const char * KEA_LOG_CHECK_VERBOSE
Definition log_utils.h:96
void remFile()
remove the test log file
Definition log_utils.cc:113
void logCheckVerbose(bool talk_a_lot)
Enables or disables verbose mode.
Definition log_utils.h:78
vector< string > exp_strings_
Definition log_utils.h:94
static const char * LOG_FILE
Definition log_utils.h:95
size_t countFile(const string &exp_string)
check that the requested string is in the test log file.
Definition log_utils.cc:84
void addString(const string &new_string)
Add a string to the vector of expected strings.
Definition log_utils.cc:117
Logging initialization functions.
Defines the logger used by the top-level component of kea-lfc.