Macros for emitting error, warning, info and debug messages through the code listener interface.
More...
#include "code_listener.h"
#include <cstdlib>
#include <sstream>
#include <string>
Go to the source code of this file.
Macros |
#define | CL_DIE(msg) |
| emit a fatal error message and ask the code listener peer to shoot down the process
|
#define | CL_MSG_STREAM(fnc, to_stream) |
| standard output stream wrapper on top of the code listener interface
|
#define | CL_MSG_STREAM_INTERNAL(fnc, to_stream) |
| wrapper around CL_MSG_STREAM decorating the message by internal location info
|
#define | CL_DEBUG(to_stream) CL_MSG_STREAM_INTERNAL(cl_debug, "debug: " << to_stream) |
| emit a debug message with internal location info
|
#define | CL_WARN(to_stream) CL_MSG_STREAM_INTERNAL(cl_warn, "warning: " << to_stream) |
| emit a warning message with internal location info
|
#define | CL_ERROR(to_stream) CL_MSG_STREAM_INTERNAL(cl_error, "error: " << to_stream) |
| emit an error message with internal location info
|
#define | CL_NOTE(to_stream) CL_MSG_STREAM_INTERNAL(cl_note, "note: " << to_stream) |
| emit a note message with internal location info
|
#define | CL_DEBUG_MSG(loc, what) CL_MSG_STREAM(cl_debug, *(loc) << "debug: " << what) |
| emit a debug message using the given location info
|
#define | CL_WARN_MSG(loc, what) CL_MSG_STREAM(cl_warn, *(loc) << "warning: " << what) |
| emit a warning message using the given location info
|
#define | CL_ERROR_MSG(loc, what) CL_MSG_STREAM(cl_error, *(loc) << "error: " << what) |
| emit an error message using the given location info
|
#define | CL_NOTE_MSG(loc, what) CL_MSG_STREAM(cl_note, *(loc) << "note: " << what) |
| emit a note message using the given location info
|
#define | CL_DEBUG_AT(level, what) |
| same as CL_DEBUG, but compares the current debug level with the given one
|
#define | CL_DEBUG_MSG_AT(level, loc, what) |
| same as CL_DEBUG_MSG, but compares current debug level with the given one
|
Functions |
std::ostream & | operator<< (std::ostream &str, const struct cl_loc &loc) |
void | cl_debug (const char *msg) |
| emit raw debug message
|
void | cl_warn (const char *msg) |
| emit raw warning message
|
void | cl_error (const char *msg) |
| emit raw error message
|
void | cl_note (const char *msg) |
| emit raw note message
|
void | cl_die (const char *msg) |
| emit raw fatal error and ask cl peer to shoot down the process
|
int | cl_debug_level (void) |
| current debugging level
|
Detailed Description
Macros for emitting error, warning, info and debug messages through the code listener interface.
Definition in file cl_msg.hh.
Macro Definition Documentation
emit a debug message with internal location info
Definition at line 75 of file cl_msg.hh.
#define CL_DEBUG_AT |
( |
|
level, |
|
|
|
what |
|
) |
| |
Value:
same as CL_DEBUG, but compares the current debug level with the given one
Definition at line 129 of file cl_msg.hh.
emit a debug message using the given location info
- Parameters
-
loc | location info to use |
what | whatever you need to stream out |
Definition at line 101 of file cl_msg.hh.
#define CL_DEBUG_MSG_AT |
( |
|
level, |
|
|
|
loc, |
|
|
|
what |
|
) |
| |
Value:
same as CL_DEBUG_MSG, but compares current debug level with the given one
Definition at line 137 of file cl_msg.hh.
Value:do { \
cl_die("fatal error: " msg "\n"); \
abort(); \
} while (0)
emit a fatal error message and ask the code listener peer to shoot down the process
- Parameters
-
msg | a message to emit before the process dies, it must be a string literal |
Definition at line 41 of file cl_msg.hh.
emit an error message with internal location info
Definition at line 87 of file cl_msg.hh.
emit an error message using the given location info
- Parameters
-
loc | location info to use |
what | whatever you need to stream out |
Definition at line 117 of file cl_msg.hh.
#define CL_MSG_STREAM |
( |
|
fnc, |
|
|
|
to_stream |
|
) |
| |
Value:do { \
break; \
\
std::ostringstream str; \
str << to_stream; \
fnc(str.str().c_str()); \
} while (0)
standard output stream wrapper on top of the code listener interface
- Parameters
-
fnc | a function used to emit the message - cl_debug(), cl_warn(), cl_error() or cl_note() |
to_stream | whatever you need to stream out. Stuff with defined operator<<(std::ostream, ...) is a viable start. |
Definition at line 53 of file cl_msg.hh.
#define CL_MSG_STREAM_INTERNAL |
( |
|
fnc, |
|
|
|
to_stream |
|
) |
| |
Value:
<< ": " << to_stream << " [internal location]")
wrapper around CL_MSG_STREAM decorating the message by internal location info
see cl_msg.hh::CL_MSG_STREAM for details
Definition at line 68 of file cl_msg.hh.
emit a note message with internal location info
Definition at line 93 of file cl_msg.hh.
emit a note message using the given location info
- Parameters
-
loc | location info to use |
what | whatever you need to stream out |
Definition at line 125 of file cl_msg.hh.
emit a warning message with internal location info
Definition at line 81 of file cl_msg.hh.
emit a warning message using the given location info
- Parameters
-
loc | location info to use |
what | whatever you need to stream out |
Definition at line 109 of file cl_msg.hh.
Function Documentation
void cl_debug |
( |
const char * |
msg | ) |
|
emit raw debug message
- Parameters
-
[in] | msg | The message to be emitted |
int cl_debug_level |
( |
void |
| ) |
|
current debugging level
- Returns
- Current debugging level
void cl_die |
( |
const char * |
msg | ) |
|
emit raw fatal error and ask cl peer to shoot down the process
- Parameters
-
[in] | msg | The message to be emitted |
void cl_error |
( |
const char * |
msg | ) |
|
emit raw error message
- Parameters
-
[in] | msg | The message to be emitted |
void cl_note |
( |
const char * |
msg | ) |
|
emit raw note message
- Parameters
-
[in] | msg | The message to be emitted |
void cl_warn |
( |
const char * |
msg | ) |
|
emit raw warning message
- Parameters
-
[in] | msg | The message to be emitted |
std::ostream& operator<< |
( |
std::ostream & |
str, |
|
|
const struct cl_loc & |
loc |
|
) |
| |
|
inline |