Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
log
test-cpp-reset-logger.cpp
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3
4
//#cmake:add-file log-common.h
5
#include "
log-common.h
"
6
7
8
TEST_CASE
(
"RESET C++ LOGGER"
,
"[log]"
) {
9
size_t
n_callbacks = 0;
10
auto
callback
= [&](
rs2_log_severity
severity
,
rs2::log_message
const
& msg)
11
{
12
++n_callbacks;
13
TRACE
(severity <<
' '
<< msg.filename() <<
'+'
<< msg.line_number() <<
": "
<< msg.raw());
14
};
15
16
rs2::log_to_callback
(
RS2_LOG_SEVERITY_INFO
,
callback
);
17
REQUIRE
(!n_callbacks);
18
rs2::reset_logger
();
19
log_all
();
20
REQUIRE
(n_callbacks == 0);
21
22
rs2::log_to_callback
(
RS2_LOG_SEVERITY_INFO
,
callback
);
23
REQUIRE
(!n_callbacks);
24
log_all
();
25
REQUIRE
(n_callbacks == 3);
26
27
rs2::reset_logger
();
28
log_all
();
29
REQUIRE
(n_callbacks == 3);
30
31
n_callbacks = 0;
32
rs2::log_to_callback
(
RS2_LOG_SEVERITY_DEBUG
,
callback
);
33
REQUIRE
(!n_callbacks);
34
log_all
();
35
REQUIRE
(n_callbacks == 4);
36
37
n_callbacks = 0;
38
rs2::reset_logger
();
39
log_all
();
40
REQUIRE
(n_callbacks == 0);
41
42
}
severity
GLenum GLuint GLenum severity
Definition:
glad/glad/glad.h:136
rs2::reset_logger
void reset_logger()
Definition:
rs.hpp:33
rs2::log_to_callback
void log_to_callback(rs2_log_severity min_severity, S callback)
Definition:
rs.hpp:139
TEST_CASE
TEST_CASE("RESET C++ LOGGER","[log]")
Definition:
test-cpp-reset-logger.cpp:8
rs2::log_message
Definition:
rs.hpp:57
RS2_LOG_SEVERITY_DEBUG
Definition:
rs_types.h:154
log_all
void log_all()
Definition:
log-common.h:35
REQUIRE
REQUIRE(n_callbacks==1)
t265_stereo.callback
def callback(frame)
Definition:
t265_stereo.py:91
TRACE
Definition:
tm-device.cpp:78
RS2_LOG_SEVERITY_INFO
Definition:
rs_types.h:155
rs2_log_severity
rs2_log_severity
Severity of the librealsense logger.
Definition:
rs_types.h:153
log-common.h
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:50:11