|
clutchlog
0.6.0
|

Modules | |
| Formating tools | |
Classes | |
| struct | clutchlog::scope_t |
| Structure holding a location matching. More... | |
Macros | |
| #define | CLUTCHLOC __FILE__, __FUNCTION__, __LINE__ |
| Handy shortcuts to location. | |
| #define | CLUTCHLOG(LEVEL, WHAT) |
| Log a message at the given level. More... | |
| #define | CLUTCHDUMP(LEVEL, CONTAINER, FILENAME) |
| Dump the given container. More... | |
| #define | CLUTCHFUNC(LEVEL, FUNC, ...) |
| Call any function if the scope matches. More... | |
| #define | CLUTCHCODE(LEVEL, ...) |
| Run any code if the scope matches. More... | |
| #define | CLUTCHLOG_DEFAULT_FORMAT "{level_letter} {msg}\t\t\t\t\t{func} @ {file}:{line}\n" |
| Default format of the messages. | |
| #define | CLUTCHDUMP_DEFAULT_FORMAT "# {level} in {func} @ {file}:{line}" |
| Default format of the comment line in file dump. | |
| #define | CLUTCHDUMP_DEFAULT_SEP "\n" |
| Default item separator for dump. | |
| #define | CLUTCHLOG_DEFAULT_DEPTH_MARK ">" |
| Default mark for stack depth. | |
| #define | CLUTCHLOG_STRIP_CALLS 5 |
| Number of call stack levels to remove from depth display by default. | |
Enumerations | |
| enum | clutchlog::fmt::fg { black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, white = 37, none } |
| Foreground color codes. | |
| enum | clutchlog::fmt::bg { black = 40, red = 41, green = 42, yellow = 43, blue = 44, magenta = 45, cyan = 46, white = 47, none } |
| Background color codes. | |
| enum | clutchlog::fmt::typo { reset = 0, bold = 1, underline = 4, inverse = 7, none } |
| Typographic style codes. | |
Functions | |
| clutchlog::fmt::fmt () | |
| Empty constructor, only useful for a no-op formatter. | |
| std::ostream & | clutchlog::fmt::print_on (std::ostream &os) const |
| Print the currently encoded format escape code on the given output stream. | |
| std::string | clutchlog::fmt::operator() (const std::string &msg) const |
| Format the given string with the currently encoded format. More... | |
Variables | |
| static std::string | clutchlog::default_format = CLUTCHLOG_DEFAULT_FORMAT |
| static std::string | clutchlog::dump_default_format = CLUTCHDUMP_DEFAULT_FORMAT |
| static std::string | clutchlog::dump_default_sep = CLUTCHDUMP_DEFAULT_SEP |
| static std::string | clutchlog::default_depth_mark = CLUTCHLOG_DEFAULT_DEPTH_MARK |
| static unsigned int | clutchlog::strip_calls = CLUTCHLOG_STRIP_CALLS |
| enum clutchlog::fmt::fg | clutchlog::fmt::fore |
| enum clutchlog::fmt::bg | clutchlog::fmt::back |
| enum clutchlog::fmt::typo | clutchlog::fmt::style |
| bool | clutchlog::scope_t::matches |
| level | clutchlog::scope_t::stage |
| bool | clutchlog::scope_t::there |
Friends | |
| std::ostream & | clutchlog::fmt::operator<< (std::ostream &os, const fmt &fmt) |
| Output stream overload. More... | |
High-level API | |
| enum | clutchlog::level { critical =0, error =1, warning =2, progress =3, note =4, info =5, debug =6, xdebug =7 } |
| Available log levels. | |
| static clutchlog & | clutchlog::logger () |
| Get the logger instance. More... | |
Internal details | |
| const size_t | clutchlog::_strip_calls |
| const std::map< level, std::string > | clutchlog::_level_word |
| std::map< std::string, level > | clutchlog::_word_level |
| std::map< level, fmt > | clutchlog::_level_fmt |
| std::string | clutchlog::_format_log |
| std::string | clutchlog::_format_dump |
| std::ostream * | clutchlog::_out |
| level | clutchlog::_stage |
| std::regex | clutchlog::_in_file |
| std::regex | clutchlog::_in_func |
| std::regex | clutchlog::_in_line |
| static const size_t | clutchlog::max_buffer = 4096 |
| clutchlog::clutchlog (clutchlog const &)=delete | |
| void | clutchlog::operator= (clutchlog const &)=delete |
Configuration accessors | |
| void | clutchlog::format (const std::string &format) |
| Set the template string. | |
| std::string | clutchlog::format () const |
| Get the template string. | |
| void | clutchlog::format_comment (const std::string &format) |
| Set the template string for dumps. | |
| std::string | clutchlog::format_comment () const |
| Get the template string for dumps. | |
| void | clutchlog::out (std::ostream &out) |
| Set the output stream on which to print. | |
| std::ostream & | clutchlog::out () |
| Get the output stream on which to print. | |
| void | clutchlog::threshold (level l) |
| Set the log level below which logs are not printed. | |
| level | clutchlog::threshold () const |
| Get the log level below which logs are not printed. | |
| void | clutchlog::file (std::string file) |
| Set the regular expression filtering the file location. | |
| void | clutchlog::func (std::string func) |
| Set the regular expression filtering the function location. | |
| void | clutchlog::line (std::string line) |
| Set the regular expression filtering the line location. | |
| void | clutchlog::location (const std::string &in_file, const std::string &in_function=".*", const std::string &in_line=".*") |
| Set the regular expressions filtering the location. | |
| template<class ... FMT> | |
| void | clutchlog::style (level stage, FMT... styles) |
| Set the style (color and typo) of the given log level. More... | |
| void | clutchlog::style (level stage, fmt style) |
Set the style (color and typo) of the given log level, passing a fmt instance. | |
| fmt | clutchlog::style (level stage) const |
| Get the configured fmt instance of the given log level. | |
| level | clutchlog::level_of (const std::string name) |
| Return the log level tag corresponding to the given pre-configured name. More... | |
Low-level API | |
| scope_t | clutchlog::locate (const level &stage, const std::string &file, const std::string &func, const size_t line) const |
| Gather information on the current location of the call. | |
| std::string | clutchlog::replace (const std::string &form, const std::string &mark, const std::string &tag) const |
Replace mark by tag in form. More... | |
| std::string | clutchlog::replace (const std::string &form, const std::string &mark, const size_t tag) const |
Replace mark by tag in form, converting tag to its string representation first. | |
| std::string | clutchlog::format (std::string format, const std::string &what, const level &stage, const std::string &file, const std::string &func, const size_t line) const |
| Substitute all tags in the format string with the corresponding information and apply the style corresponding to the log level. | |
| void | clutchlog::log (const level &stage, const std::string &what, const std::string &file, const std::string &func, size_t line) const |
| Print a log message IF the location matches the given one. | |
| template<class In > | |
| void | clutchlog::dump (const level &stage, const In container_begin, const In container_end, const std::string &file, const std::string &func, size_t line, const std::string &filename_template="dump_{n}.dat", const std::string sep=dump_default_sep) const |
| Dump a serializable container after a comment line with log information. | |
All combination of constructors with different parameters orders. | |
| clutchlog::fmt::fmt (fg f, bg b=bg::none, typo s=typo::none) | |
| clutchlog::fmt::fmt (fg f, typo s, bg b=bg::none) | |
| clutchlog::fmt::fmt (bg b, fg f=fg::none, typo s=typo::none) | |
| clutchlog::fmt::fmt (bg b, typo s, fg f=fg::none) | |
| clutchlog::fmt::fmt (typo s, fg f=fg::none, bg b=bg::none) | |
| clutchlog::fmt::fmt (typo s, bg b, fg f=fg::none) | |
| #define CLUTCHCODE | ( | LEVEL, | |
| ... | |||
| ) |
Run any code if the scope matches.
| #define CLUTCHDUMP | ( | LEVEL, | |
| CONTAINER, | |||
| FILENAME | |||
| ) |
Dump the given container.
| #define CLUTCHFUNC | ( | LEVEL, | |
| FUNC, | |||
| ... | |||
| ) |
Call any function if the scope matches.
| #define CLUTCHLOG | ( | LEVEL, | |
| WHAT | |||
| ) |
Log a message at the given level.
|
inline |
Return the log level tag corresponding to the given pre-configured name.
_level_word.
|
inlinestatic |
Get the logger instance.
|
inline |
Format the given string with the currently encoded format.
Allow to use a formatter as a function:
|
inline |
Replace mark by tag in form.
|
inline |
Set the style (color and typo) of the given log level.
This version accept style arguments as if they were passed to clutchlog::fmt.
|
friend |
Output stream overload.
Allow to use a formatter as a tag within a stream:
1.8.17