ADTF
3.18.2
test_logger.h
Go to the documentation of this file.
1
7
#pragma once
8
9
#include <
adtf_utils.h
>
10
#include <string>
11
#include <vector>
12
#include <regex>
13
#include <
adtfbase/chrono.h
>
14
15
namespace
adtf
16
{
17
namespace
system
18
{
19
namespace
testing
20
{
21
namespace
lucky
22
{
23
27
class
cTestLogger
28
{
29
public
:
30
34
struct
tMessage
35
{
36
tTimeStamp
nTimeStamp
;
37
uint8_t
nLogLevel
;
38
std::string
strText
;
39
std::string
strSource
;
40
};
41
45
struct
tMessages
:
public
std::vector<tMessage>
46
{
47
public
:
52
tMessages
Filter
(uint8_t nLogLevel);
53
58
tMessages
Filter
(
const
std::string& strContent);
59
65
tMessages
Filter
(
const
std::regex& strPattern,
bool
bPartialMatch =
true
);
66
71
tMessages
FilterSource
(
const
std::string& strContent);
72
78
tMessages
FilterSource
(
const
std::regex& strPattern,
bool
bPartialMatch =
true
);
79
84
bool
ContainsMessage
(
const
std::string& strContent);
85
91
bool
ContainsMessage
(
const
std::regex& strPattern,
bool
bPartialMatch =
true
);
92
98
tMessage
FindMessage
(
const
std::string& strContent);
99
106
tMessage
FindMessage
(
const
std::regex& strPattern,
bool
bPartialMatch =
true
);
107
};
108
113
cTestLogger
();
114
118
~cTestLogger
();
119
125
tMessages
GetCurrentMessages
(
bool
bClear =
true
);
126
132
bool
WaitForMessage
(
base::flash::tNanoSeconds
tmTimeout =
base::flash::tNanoSeconds
{-1});
133
134
private
:
135
class
cImplementation;
136
std::unique_ptr<cImplementation> m_pImplementation;
137
};
138
139
}
140
141
using
lucky::cTestLogger;
142
143
}
144
}
145
}
adtf_utils.h
Copyright © Audi Electronics Venture GmbH.
tTimeStamp
tInt64 tTimeStamp
type definition for a time value.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/base/types.h:88
chrono.h
Copyright © Audi Electronics Venture GmbH.
adtf::system::testing::lucky::cTestLogger
Utility class to record all log messages in an ADTF system during tests.
Definition:
test_logger.h:28
adtf::system::testing::lucky::cTestLogger::~cTestLogger
~cTestLogger()
Destructor.
adtf::system::testing::lucky::cTestLogger::cTestLogger
cTestLogger()
Constructor.
adtf::system::testing::lucky::cTestLogger::GetCurrentMessages
tMessages GetCurrentMessages(bool bClear=true)
Returns all messages currently received.
adtf::system::testing::lucky::cTestLogger::WaitForMessage
bool WaitForMessage(base::flash::tNanoSeconds tmTimeout=base::flash::tNanoSeconds{-1})
This blocks the calling context until either a message was received or the given timeout expired.
adtf
Namespace for entire ADTF SDK.
Definition:
ddl_specification_legacy.dox:2
adtf::base::flash::tNanoSeconds
A timestamp with nanosecond precision.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/base/include/adtfbase/chrono.h:22
adtf::system::testing::lucky::cTestLogger::tMessage
A log message.
Definition:
test_logger.h:35
adtf::system::testing::lucky::cTestLogger::tMessage::nLogLevel
uint8_t nLogLevel
the log level, see adtf::util::log::tLogLevel
Definition:
test_logger.h:37
adtf::system::testing::lucky::cTestLogger::tMessage::strSource
std::string strSource
the source of the message
Definition:
test_logger.h:39
adtf::system::testing::lucky::cTestLogger::tMessage::strText
std::string strText
the message text
Definition:
test_logger.h:38
adtf::system::testing::lucky::cTestLogger::tMessage::nTimeStamp
tTimeStamp nTimeStamp
the timestamp
Definition:
test_logger.h:36
adtf::system::testing::lucky::cTestLogger::tMessages
Utility class that allows filtering of and searching for messages.
Definition:
test_logger.h:46
adtf::system::testing::lucky::cTestLogger::tMessages::Filter
tMessages Filter(const std::regex &strPattern, bool bPartialMatch=true)
adtf::system::testing::lucky::cTestLogger::tMessages::ContainsMessage
bool ContainsMessage(const std::string &strContent)
adtf::system::testing::lucky::cTestLogger::tMessages::FindMessage
tMessage FindMessage(const std::string &strContent)
Find a message that contains the given string.
adtf::system::testing::lucky::cTestLogger::tMessages::Filter
tMessages Filter(uint8_t nLogLevel)
adtf::system::testing::lucky::cTestLogger::tMessages::FindMessage
tMessage FindMessage(const std::regex &strPattern, bool bPartialMatch=true)
Find a message that matches the given pattern.
adtf::system::testing::lucky::cTestLogger::tMessages::FilterSource
tMessages FilterSource(const std::string &strContent)
adtf::system::testing::lucky::cTestLogger::tMessages::ContainsMessage
bool ContainsMessage(const std::regex &strPattern, bool bPartialMatch=true)
adtf::system::testing::lucky::cTestLogger::tMessages::Filter
tMessages Filter(const std::string &strContent)
adtf::system::testing::lucky::cTestLogger::tMessages::FilterSource
tMessages FilterSource(const std::regex &strPattern, bool bPartialMatch=true)
Copyright © VW Group. All rights reserved. (Generated on Thu Mar 14 2024 by doxygen 1.9.1)