log.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 #include "types.h"
4 #include "log.h"
5 
6 #include <fstream>
7 
8 #ifdef BUILD_EASYLOGGINGPP
10 
11 namespace librealsense
12 {
13  char log_name[] = "librealsense";
14  static logger_type<log_name> logger;
15 }
16 
18 {
19  logger.log_to_console(min_severity);
20 }
21 
22 void librealsense::log_to_file(rs2_log_severity min_severity, const char * file_path)
23 {
24  logger.log_to_file(min_severity, file_path);
25 }
26 
28 {
29  logger.log_to_callback( min_severity, callback );
30 }
31 
33 {
34  logger.reset_logger();
35 }
36 
37 void librealsense::enable_rolling_log_file( unsigned max_size )
38 {
39  logger.enable_rolling_log_file( max_size );
40 }
41 
42 #else // BUILD_EASYLOGGINGPP
43 
45 {
46  throw std::runtime_error("log_to_console is not supported without BUILD_EASYLOGGINGPP");
47 }
48 
49 void librealsense::log_to_file(rs2_log_severity min_severity, const char * file_path)
50 {
51  throw std::runtime_error("log_to_file is not supported without BUILD_EASYLOGGINGPP");
52 }
53 
55 {
56  throw std::runtime_error("log_to_callback is not supported without BUILD_EASYLOGGINGPP");
57 }
58 
60 {
61  throw std::runtime_error("reset_logger is not supported without BUILD_EASYLOGGINGPP");
62 }
63 
64 void librealsense::enable_rolling_log_file( unsigned max_size )
65 {
66  throw std::runtime_error("enable_rolling_log_file is not supported without BUILD_EASYLOGGINGPP");
67 }
68 #endif // BUILD_EASYLOGGINGPP
69 
void reset_logger()
Definition: log.cpp:59
void log_to_callback(rs2_log_severity min_severity, log_callback_ptr callback)
Definition: log.cpp:54
void log_to_file(rs2_log_severity min_severity, const char *file_path)
Definition: log.cpp:49
std::shared_ptr< rs2_log_callback > log_callback_ptr
Definition: src/types.h:202
#define INITIALIZE_EASYLOGGINGPP
def callback(frame)
Definition: t265_stereo.py:91
void enable_rolling_log_file(unsigned max_size)
Definition: log.cpp:64
void log_to_console(rs2_log_severity min_severity)
Definition: log.cpp:44
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:153


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