test-two-files.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: static!
5 
6 //#cmake:add-file log-common.h
7 #include "log-common.h"
8 
9 
10 TEST_CASE( "Double file logging", "[log]" ) {
11 
12  // Try to log to multiple destinations: callback, console, file...
13  char filename1[L_tmpnam], filename2[L_tmpnam];
14  tmpnam( filename1 );
15  tmpnam( filename2 );
16 
17  TRACE( "Filename1 logging to: " << filename1 );
18  TRACE( "Filename2 logging to: " << filename2 );
21 
22  // Following should log to only the latter!
23  log_all();
24 
25  el::Loggers::flushAll(); // requires static!
26  REQUIRE( count_lines( filename1 ) == 0 );
27  REQUIRE( count_lines( filename2 ) == 1 );
28 }
void log_all()
Definition: log-common.h:35
size_t count_lines(char const *filename)
Definition: log-common.h:48
REQUIRE(n_callbacks==1)
static void flushAll(void)
Flushes all loggers for all levels - Be careful if you dont know how many loggers are registered...
void log_to_file(rs2_log_severity min_severity, const char *file_path=nullptr)
Definition: rs.hpp:26
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
TEST_CASE("Double file logging","[log]")


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11