Kea 2.5.8
log_utils.h
Go to the documentation of this file.
1// Copyright (C) 2016-2022 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
87 vector<string> exp_strings_;
88 static const char* LOG_FILE;
89 static const char* KEA_LOG_CHECK_VERBOSE;
90
100};
101
102} // end of isc::dhcp::test namespace
103} // end of isc::dhcp namespace
104} // end of isc namespace
105#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:99
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:89
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:87
static const char * LOG_FILE
Definition: log_utils.h:88
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.