RsUsageEnvironment.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 #include "RsUsageEnvironment.h"
5 
6 #ifdef BUILD_EASYLOGGINGPP
7 #ifdef BUILD_SHARED_LIBS
9 #endif
10 #endif
11 
12 RSUsageEnvironment::RSUsageEnvironment(TaskScheduler& taskScheduler)
13  : BasicUsageEnvironment(taskScheduler)
14 {}
15 
17 {
18  CLOG(INFO, "netdev") << "RealSense network logging closed";
19 
20  el::Loggers::unregisterLogger("librealsense");
22 }
23 
24 RSUsageEnvironment* RSUsageEnvironment::createNew(TaskScheduler& taskScheduler)
25 {
26  RSUsageEnvironment* env = new RSUsageEnvironment(taskScheduler);
27 
28  if(env)
29  {
30  env->ptr = env->buffer;
31  env->netdev_log = el::Loggers::getLogger("netdev");
32  env->lrs_log = el::Loggers::getLogger("librealsense");
33 
34  el::Loggers::reconfigureAllLoggers(el::Level::Global, el::ConfigurationType::Format, "%datetime{%y%M%d%H%m%s.%g} [%logger]\t%levshort: %msg");
38 
39  CLOG(INFO, "netdev") << "RealSense network logging initialized";
40  }
41 
42  return env;
43 }
44 
46 {
47  *ptr = '\0';
48  CLOG(INFO, "netdev") << buffer;
49  ptr = buffer;
50 }
51 
53 {
55  {
56  flush();
57  }
58 }
59 
60 UsageEnvironment& RSUsageEnvironment::operator<<(char const* str)
61 {
62  int num = 0;
63 
64  if(str == NULL)
65  str = "(NULL)"; // sanity check
66 
67  while(str[num] != '\0')
68  {
69  if(str[num] == '\n')
70  {
71  flush();
72  }
73  else
74  {
75  *ptr++ = str[num];
76  check();
77  }
78  num++;
79  }
80 
81  return *this;
82 }
83 
84 UsageEnvironment& RSUsageEnvironment::operator<<(int i)
85 {
86  ptr += sprintf(ptr, "%d", i);
87  check();
88  return *this;
89 }
90 
91 UsageEnvironment& RSUsageEnvironment::operator<<(unsigned u)
92 {
93  ptr += sprintf(ptr, "%u", u);
94  check();
95  return *this;
96 }
97 
98 UsageEnvironment& RSUsageEnvironment::operator<<(double d)
99 {
100  ptr += sprintf(ptr, "%f", d);
101  check();
102  return *this;
103 }
104 
105 UsageEnvironment& RSUsageEnvironment::operator<<(void* p)
106 {
107  ptr += sprintf(ptr, "%p", p);
108  check();
109  return *this;
110 }
#define RS_MAX_LOG_MSG_THLD
Determines whether or not corresponding level and logger of logging is enabled You may disable all lo...
GLfloat GLfloat p
Definition: glext.h:12687
Informational events most useful for developers to debug application.
d
Definition: rmse.py:171
GLenum GLfloat * buffer
CLOG(INFO,"librealsense")<< "Log message to \"librealsense\" logger"
GLuint num
Definition: glext.h:5648
RSUsageEnvironment(TaskScheduler &taskScheduler)
Determines format of logging corresponding level and logger.
char buffer[RS_MAX_LOG_MSG_SIZE]
#define INITIALIZE_EASYLOGGINGPP
virtual UsageEnvironment & operator<<(char const *str)
static void reconfigureAllLoggers(const Configurations &configurations)
Reconfigures all the existing loggers with new configurations.
static bool unregisterLogger(const std::string &identity)
Unregisters logger - use it only when you know what you are doing, you may unregister loggers initial...
static Logger * getLogger(const std::string &identity, bool registerIfNotAvailable=true)
Gets existing or registers new logger.
Generic level that represents all the levels. Useful when setting global configuration for all levels...
#define NULL
Definition: tinycthread.c:47
int i
Whether or not to write corresponding log to log file.
#define INFO(msg)
Definition: catch.hpp:17429
Whether or not to write corresponding level and logger log to standard output. By standard output mea...
static RSUsageEnvironment * createNew(TaskScheduler &taskScheduler)
#define RS_MAX_LOG_MSG_SIZE


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