Go to the documentation of this file.
47 struct DefaultOutputHandler
49 DefaultOutputHandler(
void)
52 previous_output_handler_ = output_handler_;
67 static DefaultOutputHandler* getDOH(
void)
69 static DefaultOutputHandler DOH;
74 DefaultOutputHandler *doh = getDOH(); \
75 std::lock_guard<std::mutex> lock_guard(doh->lock_)
77 #define MAX_BUFFER_SIZE 1024
84 doh->previous_output_handler_ = doh->output_handler_;
85 doh->output_handler_ =
NULL;
91 std::swap(doh->previous_output_handler_, doh->output_handler_);
97 doh->previous_output_handler_ = doh->output_handler_;
98 doh->output_handler_ = oh;
103 return getDOH()->output_handler_;
115 if (doh->output_handler_ &&
level >= doh->logLevel_)
119 char buf[MAX_BUFFER_SIZE];
121 vsnprintf_s(
buf,
sizeof(
buf), _TRUNCATE,
m, __ap);
123 vsnprintf(
buf,
sizeof(
buf),
m, __ap);
126 buf[MAX_BUFFER_SIZE - 1] =
'\0';
135 if (doh->output_handler_ &&
level >= doh->logLevel_)
139 char buf[MAX_BUFFER_SIZE];
141 vsnprintf_s(
buf,
sizeof(
buf), _TRUNCATE,
m, __ap);
143 vsnprintf(
buf,
sizeof(
buf),
m, __ap);
146 buf[MAX_BUFFER_SIZE - 1] =
'\0';
155 doh->logLevel_ =
level;
161 return doh->logLevel_;
164 static const char*
LogLevelString[4] = {
"Debug: ",
"Info: ",
"Warning: ",
"Error: "};
171 std::cerr <<
" at line " <<
line <<
" in " <<
filename << std::endl;
185 if (err != 0 || !
file_)
190 std::cerr <<
"Unable to open log file: '" <<
filename <<
"'" << std::endl;
196 if (fclose(file_) != 0)
197 std::cerr <<
"Error closing logfile" << std::endl;
LogLevel
The set of priorities for message logging.
CONSOLE_BRIDGE_DEPRECATED void log_deprecated(const char *file, int line, LogLevel level, const char *m,...)
Root level logging function. This should not be invoked directly, but rather used via a logging macro...
@ CONSOLE_BRIDGE_LOG_WARN
void log(const char *file, int line, LogLevel level, const char *m,...)
Root level logging function. This should not be invoked directly, but rather used via a logging macro...
GLsizei const GLchar *const * string
FILE * file_
The file to save to.
Default implementation of OutputHandler. This sends the information to the console.
virtual void log(const std::string &text, LogLevel level, const char *filename, int line)
log a message to the output handler with the given text and logging level from a specific file and li...
virtual ~OutputHandlerFile(void)
static const char * LogLevelString[4]
void restorePreviousOutputHandler(void)
Restore the output handler that was previously in use (if any)
OutputHandler * getOutputHandler(void)
Get the instance of the OutputHandler currently used. This is NULL in case there is no output handler...
void useOutputHandler(OutputHandler *oh)
Specify the instance of the OutputHandler to use. By default, this is OutputHandlerSTD.
void setLogLevel(LogLevel level)
Set the minimum level of logging data to output. Messages with lower logging levels will not be recor...
Generic class to handle output from a piece of code.
OutputHandlerFile(const char *filename)
The name of the file in which to save the message data.
LogLevel getLogLevel(void)
Retrieve the current level of logging data. Messages with lower logging levels will not be recorded.
void noOutputHandler(void)
This function instructs ompl that no messages should be outputted. Equivalent to useOutputHandler(NUL...
virtual void log(const std::string &text, LogLevel level, const char *filename, int line)
log a message to the output handler with the given text and logging level from a specific file and li...
GLenum GLuint GLenum GLsizei const GLchar * buf
librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01