10 #if BUILD_EASYLOGGINGPP 23 return el_msg.
file().c_str();
27 return el_msg.
message().c_str();
31 if (built_msg.empty())
33 bool const append_new_line =
false;
36 return built_msg.c_str();
40 template<
char const * NAME>
49 std::vector< std::string > callback_dispatchers;
99 defaultConf.
set(severity_to_level(static_cast<rs2_log_severity>(
i)),
105 if (minimum_file_severity != RS2_LOG_SEVERITY_NONE)
113 defaultConf.
set(severity_to_level(static_cast<rs2_log_severity>(
i)),
120 void open_def()
const 137 if (try_get_log_severity(severity))
149 static const char* severity_var_name =
"LRS_LOG_LEVEL";
150 auto content = getenv(severity_var_name);
155 std::transform(content_str.begin(), content_str.end(), content_str.begin(), ::tolower);
161 std::transform(name.begin(), name.end(), name.begin(), ::tolower);
162 if (content_str == name)
175 minimum_console_severity = min_severity;
181 if (!try_get_log_severity(minimum_file_severity))
182 minimum_file_severity = min_severity;
204 auto severity = level_to_severity( msg.
level() );
205 if( callback && severity >= min_severity )
207 log_message msg_wrapper( msg );
208 callback->on_log( severity, reinterpret_cast<rs2_log_message const&>(msg_wrapper) );
214 void remove_callbacks()
216 for(
auto const& dispatch : callback_dispatchers )
217 el::Helpers::uninstallLogDispatchCallback< elpp_dispatcher >( dispatch );
218 callback_dispatchers.clear();
225 try_get_log_severity( min_severity );
226 if( callback && min_severity != RS2_LOG_SEVERITY_NONE )
229 std::ostringstream ss;
230 ss <<
"elpp_dispatcher_" << callback_dispatchers.size();
234 callback_dispatchers.push_back( dispatch_name );
237 el::Helpers::installLogDispatchCallback< elpp_dispatcher >( dispatch_name );
238 auto dispatcher = el::Helpers::logDispatchCallback< elpp_dispatcher >( dispatch_name );
240 dispatcher->min_severity = min_severity;
263 static void rolloutHandler(
const char * filename, std::size_t
size )
269 const char* old_filename = old_file.c_str();
270 std::ifstream exists( old_filename );
271 if( exists.is_open() )
274 std::remove( old_filename );
277 std::rename( filename, old_filename );
289 auto max_size_in_bytes = max_size * 1024 * 1024;
300 #else //BUILD_EASYLOGGINGPP 305 throw std::runtime_error(
"rs2_get_log_message_line_number is not supported without BUILD_EASYLOGGINGPP");
309 throw std::runtime_error(
"rs2_get_log_message_filename is not supported without BUILD_EASYLOGGINGPP");
313 throw std::runtime_error(
"rs2_get_raw_log_message is not supported without BUILD_EASYLOGGINGPP");
317 throw std::runtime_error(
"rs2_get_full_log_message is not supported without BUILD_EASYLOGGINGPP");
320 #endif //BUILD_EASYLOGGINGPP
const base::type::string_t & message(void) const
GLenum GLuint GLenum severity
const char * get_log_message_filename() const
const char * get_string(rs2_rs400_visual_preset value)
static void installPreRollOutCallback(const PreRollOutCallback &callback)
Installs pre rollout callback, this callback is triggered when log file is about to be rolled out (ca...
static Logger * reconfigureLogger(Logger *logger, const Configurations &configurations)
Reconfigures specified logger with new configurations.
virtual base::type::string_t build(const LogMessage *logMessage, bool appendNewLine) const =0
GLuint const GLchar * name
Information representing errors in application but application will keep running. ...
const char * get_full_log_message()
void log_to_callback(rs2_log_severity min_severity, log_callback_ptr callback)
GLuint64 GLenum void * handle
Informational events most useful for developers to debug application.
void set(Level level, ConfigurationType configurationType, const std::string &value)
Sets value of configuration for specified level.
Severe error information that will presumably abort application.
void setGlobally(ConfigurationType configurationType, const std::string &value)
Sets configuration for all levels.
GLsizei const GLchar *const * string
void log_to_file(rs2_log_severity min_severity, const char *file_path)
Represents unknown level.
Level
Represents enumeration for severity level used to determine level of logging.
Determines log file (full path) to write logs to for correponding level and logger.
std::shared_ptr< rs2_log_callback > log_callback_ptr
Information that can be highly useful and vary with verbose logging level.
Determines format of logging corresponding level and logger.
unsigned get_log_message_line_number() const
std::string datetime_string()
Useful when application has potentially harmful situtaions.
LogBuilder * logBuilder(void) const
Thread-safe Configuration repository.
Mainly useful to represent current progress of application.
void enable_rolling_log_file(unsigned max_size)
Specifies number of log entries to hold until we flush pending log data.
base::type::LineNumber line(void) const
Whether or not to write corresponding log to log file.
Whether or not to write corresponding level and logger log to standard output. By standard output mea...
GLuint GLenum GLenum transform
void log_to_console(rs2_log_severity min_severity)
Logger * logger(void) const
const char * get_raw_log_message() const
rs2_log_severity
Severity of the librealsense logger.
const std::string & file(void) const
Information that can be useful to back-trace certain events - mostly useful than debug logs...
Specifies log file max size.
void setToDefault(void)
Sets configurations to "factory based" configurations.
std::string to_string(T value)