diff --git a/CMakeLists.txt b/CMakeLists.txt index b794cc4..bf0b78d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR) project("clutchlog" - VERSION 0.16 + VERSION 0.17 DESCRIPTION "A logging system which targets versatile debugging") enable_language(CXX) # C++ diff --git a/docs/annotated.html b/docs/annotated.html index 7a8cdd9..37e60d2 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -28,7 +28,7 @@ Logo
clutchlog -  0.15 +  0.16
diff --git a/docs/classclutchlog-members.html b/docs/classclutchlog-members.html index 2fef3b8..f817574 100644 --- a/docs/classclutchlog-members.html +++ b/docs/classclutchlog-members.html @@ -28,7 +28,7 @@ Logo
clutchlog -  0.15 +  0.16
@@ -92,19 +92,21 @@ $(document).ready(function(){initNavTree('classclutchlog.html',''); initResizabl

This is the complete list of members for clutchlog, including all inherited members.

- - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -116,43 +118,50 @@ $(document).ready(function(){initNavTree('classclutchlog.html',''); initResizabl - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + +
_filehash_fmtsclutchlogprotected
_format_dumpclutchlogprotected
_format_logclutchlogprotected
_funchash_fmtsclutchlogprotected
_in_fileclutchlogprotected
_in_funcclutchlogprotected
_in_lineclutchlogprotected
_level_fmtclutchlogprotected
_level_shortclutchlogprotected
_level_wordclutchlogprotected
_outclutchlogprotected
_stageclutchlogprotected
_strip_callsclutchlogprotected
_word_levelclutchlogprotected
_filenameclutchlogprotected
_format_dumpclutchlogprotected
_format_logclutchlogprotected
_funchash_fmtsclutchlogprotected
_in_fileclutchlogprotected
_in_funcclutchlogprotected
_in_lineclutchlogprotected
_level_fmtclutchlogprotected
_level_shortclutchlogprotected
_level_wordclutchlogprotected
_outclutchlogprotected
_stageclutchlogprotected
_strip_callsclutchlogprotected
_word_levelclutchlogprotected
base enum value (defined in clutchlog)clutchlog
clutchlog(clutchlog const &)=delete (defined in clutchlog)clutchlog
clutchlog() (defined in clutchlog)clutchloginlineprivate
critical enum value (defined in clutchlog)clutchlog
default_hfill_minclutchloginlineprotectedstatic
default_strip_callsclutchloginlineprotectedstatic
depth_styles(std::vector< fmt > styles)clutchloginline
dump(const level &stage, const In container_begin, const In container_end, const std::string &file, const std::string &func, const size_t line, const std::string &filename_template="dump_{n}.dat", const std::string sep=dump_default_sep) constclutchloginline
dump_default_formatclutchloginlineprotectedstatic
dump_default_sepclutchloginlineprotectedstatic
error enum value (defined in clutchlog)clutchlog
file(std::string file)clutchloginline
filehash_styles(std::vector< fmt > styles)clutchloginline
format(const std::string &format)clutchloginline
format() constclutchloginline
format(std::string row, const std::string &what, const level &stage, const std::string &file, const std::string &func, const size_t line) constclutchloginline
format_comment(const std::string &format)clutchloginline
format_comment() constclutchloginline
func(std::string func)clutchloginline
funchash_styles(std::vector< fmt > styles)clutchloginline
info enum value (defined in clutchlog)clutchlog
level enum nameclutchlog
level_of(const std::string name)clutchloginline
levels() constclutchloginline
line(std::string line)clutchloginline
locate(const level &stage, const std::string &file, const std::string &func, const size_t line) constclutchloginline
location(const std::string &in_file, const std::string &in_function=".*", const std::string &in_line=".*")clutchloginline
log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) constclutchloginline
logger()clutchloginlinestatic
note enum value (defined in clutchlog)clutchlog
operator=(clutchlog const &)=delete (defined in clutchlog)clutchlog
out(std::ostream &out)clutchloginline
out()clutchloginline
dir enum value (defined in clutchlog)clutchlog
dirbase enum value (defined in clutchlog)clutchlog
dirstem enum value (defined in clutchlog)clutchlog
dump(const level &stage, const In container_begin, const In container_end, const std::string &file, const std::string &func, const size_t line, const std::string &filename_template="dump_{n}.dat", const std::string sep=dump_default_sep) constclutchloginline
dump_default_formatclutchloginlineprotectedstatic
dump_default_sepclutchloginlineprotectedstatic
error enum value (defined in clutchlog)clutchlog
file(std::string file)clutchloginline
filehash_styles(std::vector< fmt > styles)clutchloginline
filename enum nameclutchlog
filename(filename f)clutchloginline
format(const std::string &format)clutchloginline
format() constclutchloginline
format(std::string row, const std::string &what, const level &stage, const std::string &file, const std::string &func, const size_t line) constclutchloginline
format_comment(const std::string &format)clutchloginline
format_comment() constclutchloginline
func(std::string func)clutchloginline
funchash_styles(std::vector< fmt > styles)clutchloginline
info enum value (defined in clutchlog)clutchlog
level enum nameclutchlog
level_of(const std::string name)clutchloginline
levels() constclutchloginline
line(std::string line)clutchloginline
locate(const level &stage, const std::string &file, const std::string &func, const size_t line) constclutchloginline
location(const std::string &in_file, const std::string &in_function=".*", const std::string &in_line=".*")clutchloginline
log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) constclutchloginline
logger()clutchloginlinestatic
note enum value (defined in clutchlog)clutchlog
operator=(clutchlog const &)=delete (defined in clutchlog)clutchlog
out(std::ostream &out)clutchloginline
out()clutchloginline
path enum value (defined in clutchlog)clutchlog
progress enum value (defined in clutchlog)clutchlog
replace(const std::string &form, const std::string &mark, const std::string &tag) constclutchloginline
replace(const std::string &form, const std::string &mark, const size_t tag) constclutchloginline
style(level stage, FMT... styles)clutchloginline
style(level stage, fmt style)clutchloginline
style(level stage) constclutchloginline
threshold(level l)clutchloginline
threshold(const std::string &l)clutchloginline
threshold() constclutchloginline
warning enum value (defined in clutchlog)clutchlog
xdebug enum value (defined in clutchlog)clutchlog
stem enum value (defined in clutchlog)clutchlog
style(level stage, FMT... styles)clutchloginline
style(level stage, fmt style)clutchloginline
style(level stage) constclutchloginline
threshold(level l)clutchloginline
threshold(const std::string &l)clutchloginline
threshold() constclutchloginline
warning enum value (defined in clutchlog)clutchlog
xdebug enum value (defined in clutchlog)clutchlog
diff --git a/docs/classclutchlog.html b/docs/classclutchlog.html index 907d2d3..31e86fb 100644 --- a/docs/classclutchlog.html +++ b/docs/classclutchlog.html @@ -28,7 +28,7 @@ Logo
clutchlog -  0.15 +  0.16
@@ -185,6 +185,10 @@ void fmt style (level stage) const  Get the configured fmt instance of the given log level.
  + +void filename (filename f) + Sets the file naming scheme. *‍/.
Low-level API
scope_t locate (const level &stage, const std::string &file, const std::string &func, const size_t line) const @@ -272,6 +276,18 @@ High-level API }  Available log levels.
  +enum  filename {
+  path, +base, +dir, +dirbase, +
+  stem, +dirstem +
+ } + Available filename rendering methods.
+  static clutchloglogger ()  Get the logger instance. More...
  @@ -334,6 +350,10 @@ std::vector< fmt > std::vector< fmt_funchash_fmts  List of candidate format objects for value-dependant function name styling.
  + +filename _filename + Filename rendering method.
 clutchlog (clutchlog const &)=delete   @@ -403,9 +423,9 @@ void operator= (Style will be chosen based on the hash value of the filename among the candidate ones.

See the {filehash_fmt} template tag.

-

Definition at line 1038 of file clutchlog.h.

+

Definition at line 1045 of file clutchlog.h.

-

References _filehash_fmts.

+

References _filehash_fmts.

@@ -437,9 +457,9 @@ void operator= (Style will be chosen based on the hash value of the filename among the candidate ones.

See the {funchash_fmt} template tag.

-

Definition at line 1046 of file clutchlog.h.

+

Definition at line 1053 of file clutchlog.h.

-

References _funchash_fmts.

+

References _funchash_fmts.

@@ -471,7 +491,7 @@ void operator= (The given list should be ordered, styles will be applied for the corresponding depth level. If the actual depth is larger than the number of styles, the last one is used.

See the {depth_fmt} template tag.

-

Definition at line 1055 of file clutchlog.h.

+

Definition at line 1062 of file clutchlog.h.

@@ -502,11 +522,11 @@ void operator= (Return the log level tag corresponding to the given pre-configured name.

Note
This is case sensitive, see the pre-configured _level_word.
-

Definition at line 1070 of file clutchlog.h.

+

Definition at line 1077 of file clutchlog.h.

-

References _word_level.

+

References _word_level.

-

Referenced by threshold().

+

Referenced by threshold().

@@ -549,11 +569,11 @@ template<class ... FMT>

Set the style (color and typo) of the given log level.

This version accept style arguments as if they were passed to clutchlog::fmt.

-

Definition at line 1104 of file clutchlog.h.

+

Definition at line 1111 of file clutchlog.h.

-

References style().

+

References style().

-

Referenced by style().

+

Referenced by style().

@@ -601,9 +621,9 @@ template<class ... FMT>
log.replace("{greet} {world}", "\\{greet\\}", "hello");
// returns "hello {world}"
-

Definition at line 1193 of file clutchlog.h.

+

Definition at line 1203 of file clutchlog.h.

-

Referenced by dump(), format(), and replace().

+

Referenced by dump(), format(), and replace().

@@ -613,7 +633,7 @@ template<class ... FMT>
clutchlog::logger
static clutchlog & logger()
Get the logger instance.
Definition: clutchlog.h:306
-
clutchlog::log
void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) const
Print a log message IF the location matches the given one.
Definition: clutchlog.h:1374
+
clutchlog::log
void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) const
Print a log message IF the location matches the given one.
Definition: clutchlog.h:1412
@@ -415,9 +415,9 @@ std::ostream &  diff --git a/docs/clutchlog_8h.html b/docs/clutchlog_8h.html index 2dbb3b1..1dc3cd5 100644 --- a/docs/clutchlog_8h.html +++ b/docs/clutchlog_8h.html @@ -28,7 +28,7 @@ diff --git a/docs/clutchlog_8h__dep__incl.map b/docs/clutchlog_8h__dep__incl.map index 4740dc4..8180ccb 100644 --- a/docs/clutchlog_8h__dep__incl.map +++ b/docs/clutchlog_8h__dep__incl.map @@ -1,5 +1,5 @@ - + @@ -8,8 +8,9 @@ - - - - + + + + + diff --git a/docs/clutchlog_8h__dep__incl.md5 b/docs/clutchlog_8h__dep__incl.md5 index 440c2e6..80b393d 100644 --- a/docs/clutchlog_8h__dep__incl.md5 +++ b/docs/clutchlog_8h__dep__incl.md5 @@ -1 +1 @@ -03a5adb412c477109d73f308278ec653 \ No newline at end of file +a81a51c1f045be087627e35d5e6b32ef \ No newline at end of file diff --git a/docs/clutchlog_8h__dep__incl.svg b/docs/clutchlog_8h__dep__incl.svg index 1422fbd..e4f4e4c 100644 --- a/docs/clutchlog_8h__dep__incl.svg +++ b/docs/clutchlog_8h__dep__incl.svg @@ -46,7 +46,7 @@ if (edges && edges.length) { @@ -54,13 +54,13 @@ var sectionId = 'dynsection-1'; clutchlog.h - + Node1 - -clutchlog.h + +clutchlog.h @@ -76,8 +76,8 @@ var sectionId = 'dynsection-1'; Node1->Node2 - - + + @@ -91,8 +91,8 @@ var sectionId = 'dynsection-1'; Node1->Node3 - - + + @@ -106,8 +106,8 @@ var sectionId = 'dynsection-1'; Node1->Node4 - - + + @@ -121,8 +121,8 @@ var sectionId = 'dynsection-1'; Node1->Node5 - - + + @@ -136,8 +136,8 @@ var sectionId = 'dynsection-1'; Node1->Node6 - - + + @@ -151,8 +151,8 @@ var sectionId = 'dynsection-1'; Node1->Node7 - - + + @@ -166,8 +166,8 @@ var sectionId = 'dynsection-1'; Node1->Node8 - - + + @@ -181,68 +181,83 @@ var sectionId = 'dynsection-1'; Node1->Node9 - - + + Node10 - - -t-fmt-constructors.cpp + + +t-filename.cpp Node1->Node10 - - + + Node11 - - -t-hash-color.cpp + + +t-fmt-constructors.cpp Node1->Node11 - - + + Node12 - - -t-log.cpp + + +t-hash-color.cpp Node1->Node12 - - + + Node13 - - -t-one-line-if.cpp + + +t-log.cpp Node1->Node13 - - + + + + + +Node14 + + +t-one-line-if.cpp + + + + + +Node1->Node14 + + diff --git a/docs/clutchlog_8h__dep__incl_org.svg b/docs/clutchlog_8h__dep__incl_org.svg index 3682d73..bcf3f63 100644 --- a/docs/clutchlog_8h__dep__incl_org.svg +++ b/docs/clutchlog_8h__dep__incl_org.svg @@ -4,17 +4,17 @@ - + clutchlog.h - + Node1 - -clutchlog.h + +clutchlog.h @@ -30,8 +30,8 @@ Node1->Node2 - - + + @@ -45,8 +45,8 @@ Node1->Node3 - - + + @@ -60,8 +60,8 @@ Node1->Node4 - - + + @@ -75,8 +75,8 @@ Node1->Node5 - - + + @@ -90,8 +90,8 @@ Node1->Node6 - - + + @@ -105,8 +105,8 @@ Node1->Node7 - - + + @@ -120,8 +120,8 @@ Node1->Node8 - - + + @@ -135,68 +135,83 @@ Node1->Node9 - - + + Node10 - - -t-fmt-constructors.cpp + + +t-filename.cpp Node1->Node10 - - + + Node11 - - -t-hash-color.cpp + + +t-fmt-constructors.cpp Node1->Node11 - - + + Node12 - - -t-log.cpp + + +t-hash-color.cpp Node1->Node12 - - + + Node13 - - -t-one-line-if.cpp + + +t-log.cpp Node1->Node13 - - + + + + + +Node14 + + +t-one-line-if.cpp + + + + + +Node1->Node14 + + diff --git a/docs/clutchlog_8h_source.html b/docs/clutchlog_8h_source.html index 71543c2..fe6753b 100644 --- a/docs/clutchlog_8h_source.html +++ b/docs/clutchlog_8h_source.html @@ -28,7 +28,7 @@ Logo @@ -343,1177 +343,1216 @@ $(document).ready(function(){initNavTree('clutchlog_8h_source.html',''); initRes
311 
313  enum level {critical=0, error=1, warning=2, progress=3, note=4, info=5, debug=6, xdebug=7};
314 
-
376  class fmt {
-
377  public:
-
379  enum class ansi {
-
381  colors_16 = -1, // Not supposed to be casted.
-
383  colors_256 = 5, // Casted as short in color::operator<<.
-
385  colors_16M = 2 // Casted as short in color::operator<<
-
386  } mode;
-
387 
-
389  enum class typo {
-
390  reset = 0,
-
391  bold = 1,
-
392  underline = 4,
-
393  inverse = 7,
-
394  none = -1
-
395  } style;
-
396 
-
399  enum class fg {
-
401  black = 30,
-
402  red = 31,
-
403  green = 32,
-
404  yellow = 33,
-
405  blue = 34,
-
406  magenta = 35,
-
407  cyan = 36,
-
408  white = 37,
-
409  bright_black = 90,
-
410  bright_red = 91,
-
411  bright_green = 92,
-
412  bright_yellow = 93,
-
413  bright_blue = 94,
-
414  bright_magenta = 95,
-
415  bright_cyan = 96,
-
416  bright_white = 97,
-
417  none = -1
-
418  } fore;
-
419 
-
421  enum class bg {
-
422  black = 40,
-
423  red = 41,
-
424  green = 42,
-
425  yellow = 43,
-
426  blue = 44,
-
427  magenta = 45,
-
428  cyan = 46,
-
429  white = 47,
-
430  bright_black = 100,
-
431  bright_red = 101,
-
432  bright_green = 102,
-
433  bright_yellow = 103,
-
434  bright_blue = 104,
-
435  bright_magenta = 105,
-
436  bright_cyan = 106,
-
437  bright_white = 107,
-
438  none = -1
-
439  } back;
-
440 
-
441  protected:
-
443  friend std::ostream& operator<<(std::ostream& os, const std::tuple<fg,bg,typo>& fbs)
-
444  {
-
445  auto [f,b,s] = fbs;
-
446  std::vector<short> codes; codes.reserve(3);
-
447  if(f != fg::none) { codes.push_back(static_cast<short>(f));}
-
448  if(b != bg::none) { codes.push_back(static_cast<short>(b));}
-
449  if(s != typo::none) { codes.push_back(static_cast<short>(s));}
-
450  if(codes.size() == 0) {
-
451  return os;
-
452 
-
453  } else {
-
454  os << "\033[";
-
455  os << codes[0];
-
456  for(size_t i=1; i < codes.size(); ++i) {
-
457  os << ";" << codes[i];
-
458  }
-
459  os << "m";
-
460  }
-
461  return os;
-
462  }
-
463 
-
465  friend std::ostream& operator<<(std::ostream& os, const typo& s)
-
466  {
-
467  if(s != typo::none) {
-
468  os << "\033[" << static_cast<short>(s) << "m";
-
469  }
-
470  return os;
-
471  }
-
472 
-
475  protected:
-
480  struct color {
-
481  ansi mode; // Not const to allow for the implicit copy assignemnt operator.
-
482 
-
484  enum class ground { // idem.
-
485  fore = 38,
-
486  back = 48
-
487  } type;
-
488 
-
494  color(ansi a, ground g) : mode(a), type(g) {}
-
495 
-
497  virtual bool is_set() const = 0;
+
316  enum filename {path, base, dir, dirbase, stem, dirstem};
+
317 
+
379  class fmt {
+
380  public:
+
382  enum class ansi {
+
384  colors_16 = -1, // Not supposed to be casted.
+
386  colors_256 = 5, // Casted as short in color::operator<<.
+
388  colors_16M = 2 // Casted as short in color::operator<<
+
389  } mode;
+
390 
+
392  enum class typo {
+
393  reset = 0,
+
394  bold = 1,
+
395  underline = 4,
+
396  inverse = 7,
+
397  none = -1
+
398  } style;
+
399 
+
402  enum class fg {
+
404  black = 30,
+
405  red = 31,
+
406  green = 32,
+
407  yellow = 33,
+
408  blue = 34,
+
409  magenta = 35,
+
410  cyan = 36,
+
411  white = 37,
+
412  bright_black = 90,
+
413  bright_red = 91,
+
414  bright_green = 92,
+
415  bright_yellow = 93,
+
416  bright_blue = 94,
+
417  bright_magenta = 95,
+
418  bright_cyan = 96,
+
419  bright_white = 97,
+
420  none = -1
+
421  } fore;
+
422 
+
424  enum class bg {
+
425  black = 40,
+
426  red = 41,
+
427  green = 42,
+
428  yellow = 43,
+
429  blue = 44,
+
430  magenta = 45,
+
431  cyan = 46,
+
432  white = 47,
+
433  bright_black = 100,
+
434  bright_red = 101,
+
435  bright_green = 102,
+
436  bright_yellow = 103,
+
437  bright_blue = 104,
+
438  bright_magenta = 105,
+
439  bright_cyan = 106,
+
440  bright_white = 107,
+
441  none = -1
+
442  } back;
+
443 
+
444  protected:
+
446  friend std::ostream& operator<<(std::ostream& os, const std::tuple<fg,bg,typo>& fbs)
+
447  {
+
448  auto [f,b,s] = fbs;
+
449  std::vector<short> codes; codes.reserve(3);
+
450  if(f != fg::none) { codes.push_back(static_cast<short>(f));}
+
451  if(b != bg::none) { codes.push_back(static_cast<short>(b));}
+
452  if(s != typo::none) { codes.push_back(static_cast<short>(s));}
+
453  if(codes.size() == 0) {
+
454  return os;
+
455 
+
456  } else {
+
457  os << "\033[";
+
458  os << codes[0];
+
459  for(size_t i=1; i < codes.size(); ++i) {
+
460  os << ";" << codes[i];
+
461  }
+
462  os << "m";
+
463  }
+
464  return os;
+
465  }
+
466 
+
468  friend std::ostream& operator<<(std::ostream& os, const typo& s)
+
469  {
+
470  if(s != typo::none) {
+
471  os << "\033[" << static_cast<short>(s) << "m";
+
472  }
+
473  return os;
+
474  }
+
475 
+
478  protected:
+
483  struct color {
+
484  ansi mode; // Not const to allow for the implicit copy assignemnt operator.
+
485 
+
487  enum class ground { // idem.
+
488  fore = 38,
+
489  back = 48
+
490  } type;
+
491 
+
497  color(ansi a, ground g) : mode(a), type(g) {}
498 
-
500  virtual std::ostream& print_on( std::ostream& os) const = 0;
+
500  virtual bool is_set() const = 0;
501 
-
503  friend std::ostream& operator<<(std::ostream& os, const color& c)
-
504  {
-
505  if(c.is_set()) {
-
506  os << "\033[" << static_cast<short>(c.type) << ";" << static_cast<short>(c.mode) << ";";
-
507  c.print_on(os);
-
508  os << "m";
-
509  }
-
510  return os;
-
511  }
-
512  };
-
513 
-
514  // There is no color_16 because it would be the same as color_256, only with different indices,
-
515  // hence making it more complicated for the user to select the right constructor.
-
516  // Here, we just use enum for 16 colors, and indices for 256 colors.
-
517 
-
519  struct color_256 : public color {
-
523  short index;
-
524 
-
528  color_256(ground t) : color(ansi::colors_256, t), index(-1) {}
-
529 
-
535  color_256(ground t, const short i) : color(ansi::colors_256, t), index(i) {assert(-1 <= i and i <= 255);}
-
536 
-
538  bool is_set() const {return index > -1;}
+
503  virtual std::ostream& print_on( std::ostream& os) const = 0;
+
504 
+
506  friend std::ostream& operator<<(std::ostream& os, const color& c)
+
507  {
+
508  if(c.is_set()) {
+
509  os << "\033[" << static_cast<short>(c.type) << ";" << static_cast<short>(c.mode) << ";";
+
510  c.print_on(os);
+
511  os << "m";
+
512  }
+
513  return os;
+
514  }
+
515  };
+
516 
+
517  // There is no color_16 because it would be the same as color_256, only with different indices,
+
518  // hence making it more complicated for the user to select the right constructor.
+
519  // Here, we just use enum for 16 colors, and indices for 256 colors.
+
520 
+
522  struct color_256 : public color {
+
526  short index;
+
527 
+
531  color_256(ground t) : color(ansi::colors_256, t), index(-1) {}
+
532 
+
538  color_256(ground t, const short i) : color(ansi::colors_256, t), index(i) {assert(-1 <= i and i <= 255);}
539 
-
541  std::ostream& print_on( std::ostream& os) const
-
542  {
-
543  os << index;
-
544  return os;
-
545  }
-
546  };
-
547 
-
549  struct fg_256 : public color_256 {
-
551  fg_256() : color_256(ground::fore) {}
-
552 
-
556  fg_256(const short f) : color_256(ground::fore, f) {}
-
557 
-
561  fg_256(const fg&) : color_256(ground::fore, -1) {}
-
562 
-
563  } fore_256;
-
564 
-
566  struct bg_256 : public color_256 {
-
568  bg_256() : color_256(ground::back) {}
-
569 
-
573  bg_256(const short b) : color_256(ground::back, b) {}
-
574 
-
578  bg_256(const bg&) : color_256(ground::back, -1) {}
-
579 
-
580  } back_256;
-
581 
-
583  struct color_16M : public color {
-
587  short red, green, blue;
-
588 
-
592  color_16M(ground t) : color(ansi::colors_16M, t), red(-1), green(-1), blue(-1) {}
-
593 
-
601  color_16M(ground t, short r, short g, short b)
-
602  : color(ansi::colors_16M, t), red(r), green(g), blue(b) {}
-
603 
-
611  color_16M(ground t, const std::string& srgb) : color(ansi::colors_16M, t)
-
612  {
-
613  assert(srgb.size() == 7);
-
614  if(srgb.size() != 7) {
-
615  red = -1;
-
616  green = -1;
-
617  blue = -1;
-
618  } else {
-
619  char i = 0;
-
620  if(srgb.at(0) == '#') {
-
621  i = 1;
-
622  }
-
623  std::istringstream(srgb.substr(0+i,2)) >> std::hex >> red;
-
624  std::istringstream(srgb.substr(2+i,2)) >> std::hex >> green;
-
625  std::istringstream(srgb.substr(4+i,2)) >> std::hex >> blue;
-
626  }
-
627  assert(-1 <= red and red <= 255);
-
628  assert(-1 <= green and green <= 255);
-
629  assert(-1 <= blue and blue <= 255);
-
630  }
-
631 
-
633  bool is_set() const {return red > -1 and green > -1 and blue > -1;}
+
541  bool is_set() const {return index > -1;}
+
542 
+
544  std::ostream& print_on( std::ostream& os) const
+
545  {
+
546  os << index;
+
547  return os;
+
548  }
+
549  };
+
550 
+
552  struct fg_256 : public color_256 {
+
554  fg_256() : color_256(ground::fore) {}
+
555 
+
559  fg_256(const short f) : color_256(ground::fore, f) {}
+
560 
+
564  fg_256(const fg&) : color_256(ground::fore, -1) {}
+
565 
+
566  } fore_256;
+
567 
+
569  struct bg_256 : public color_256 {
+
571  bg_256() : color_256(ground::back) {}
+
572 
+
576  bg_256(const short b) : color_256(ground::back, b) {}
+
577 
+
581  bg_256(const bg&) : color_256(ground::back, -1) {}
+
582 
+
583  } back_256;
+
584 
+
586  struct color_16M : public color {
+
590  short red, green, blue;
+
591 
+
595  color_16M(ground t) : color(ansi::colors_16M, t), red(-1), green(-1), blue(-1) {}
+
596 
+
604  color_16M(ground t, short r, short g, short b)
+
605  : color(ansi::colors_16M, t), red(r), green(g), blue(b) {}
+
606 
+
614  color_16M(ground t, const std::string& srgb) : color(ansi::colors_16M, t)
+
615  {
+
616  assert(srgb.size() == 7);
+
617  if(srgb.size() != 7) {
+
618  red = -1;
+
619  green = -1;
+
620  blue = -1;
+
621  } else {
+
622  char i = 0;
+
623  if(srgb.at(0) == '#') {
+
624  i = 1;
+
625  }
+
626  std::istringstream(srgb.substr(0+i,2)) >> std::hex >> red;
+
627  std::istringstream(srgb.substr(2+i,2)) >> std::hex >> green;
+
628  std::istringstream(srgb.substr(4+i,2)) >> std::hex >> blue;
+
629  }
+
630  assert(-1 <= red and red <= 255);
+
631  assert(-1 <= green and green <= 255);
+
632  assert(-1 <= blue and blue <= 255);
+
633  }
634 
-
636  std::ostream& print_on( std::ostream& os) const
-
637  {
-
638  os << red << ";" << green << ";" << blue;
-
639  return os;
-
640  }
-
641  };
-
642 
-
644  struct fg_16M : public color_16M {
-
646  fg_16M() : color_16M(ground::fore) {}
-
647 
-
656  fg_16M(short r, short g, short b) : color_16M(ground::fore, r,g,b) {}
-
657 
-
664  fg_16M(const std::string& srgb) : color_16M(ground::fore, srgb) {}
-
665 
-
669  fg_16M(const fg&) : color_16M(ground::fore, -1,-1,-1) {}
-
670 
-
671  } fore_16M;
-
672 
-
674  struct bg_16M : public color_16M {
-
676  bg_16M() : color_16M(ground::back) {}
-
677 
-
686  bg_16M(short r, short g, short b) : color_16M(ground::back, r,g,b) {}
-
687 
-
694  bg_16M(const std::string& srgb) : color_16M(ground::back, srgb) {}
-
695 
-
699  bg_16M(const bg&) : color_16M(ground::back, -1,-1,-1) {}
-
700 
-
701  } back_16M;
-
702 
-
705  public:
-
707  fmt() : mode(ansi::colors_16), style(typo::none), fore(fg::none), back(bg::none) {}
-
708 
-
711  fmt( fg f, bg b = bg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
712  fmt( fg f, typo s , bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
713  fmt( bg b, fg f = fg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
714  fmt( bg b, typo s , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
715  fmt(typo s, fg f = fg::none, bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
716  fmt(typo s, bg b , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
721  fmt(fg_256 f, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(b) {}
-
722  fmt(fg_256 f, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(bg::none) {}
-
723  fmt(fg, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(fg::none), back_256(b) {}
-
728  fmt(const short fr, const short fg, const short fb,
-
729  const short gr, const short gg, const short gb,
-
730  typo s = typo::none)
-
731  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(gr,gg,gb) {}
-
732  fmt(fg,
-
733  const short gr, const short gg, const short gb,
-
734  typo s = typo::none)
-
735  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(gr,gg,gb) {}
-
736  fmt(const short fr, const short fg, const short fb,
-
737  bg, typo s = typo::none)
-
738  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
+
636  bool is_set() const {return red > -1 and green > -1 and blue > -1;}
+
637 
+
639  std::ostream& print_on( std::ostream& os) const
+
640  {
+
641  os << red << ";" << green << ";" << blue;
+
642  return os;
+
643  }
+
644  };
+
645 
+
647  struct fg_16M : public color_16M {
+
649  fg_16M() : color_16M(ground::fore) {}
+
650 
+
659  fg_16M(short r, short g, short b) : color_16M(ground::fore, r,g,b) {}
+
660 
+
667  fg_16M(const std::string& srgb) : color_16M(ground::fore, srgb) {}
+
668 
+
672  fg_16M(const fg&) : color_16M(ground::fore, -1,-1,-1) {}
+
673 
+
674  } fore_16M;
+
675 
+
677  struct bg_16M : public color_16M {
+
679  bg_16M() : color_16M(ground::back) {}
+
680 
+
689  bg_16M(short r, short g, short b) : color_16M(ground::back, r,g,b) {}
+
690 
+
697  bg_16M(const std::string& srgb) : color_16M(ground::back, srgb) {}
+
698 
+
702  bg_16M(const bg&) : color_16M(ground::back, -1,-1,-1) {}
+
703 
+
704  } back_16M;
+
705 
+
708  public:
+
710  fmt() : mode(ansi::colors_16), style(typo::none), fore(fg::none), back(bg::none) {}
+
711 
+
714  fmt( fg f, bg b = bg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
715  fmt( fg f, typo s , bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
716  fmt( bg b, fg f = fg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
717  fmt( bg b, typo s , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
718  fmt(typo s, fg f = fg::none, bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
719  fmt(typo s, bg b , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
724  fmt(fg_256 f, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(b) {}
+
725  fmt(fg_256 f, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(bg::none) {}
+
726  fmt(fg, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(fg::none), back_256(b) {}
+
731  fmt(const short fr, const short fg, const short fb,
+
732  const short gr, const short gg, const short gb,
+
733  typo s = typo::none)
+
734  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(gr,gg,gb) {}
+
735  fmt(fg,
+
736  const short gr, const short gg, const short gb,
+
737  typo s = typo::none)
+
738  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(gr,gg,gb) {}
739  fmt(const short fr, const short fg, const short fb,
-
740  typo s = typo::none)
+
740  bg, typo s = typo::none)
741  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
-
742 
-
743  fmt(const std::string& f, const std::string& b, typo s = typo::none)
-
744  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(b) {}
-
745  fmt(fg, const std::string& b, typo s = typo::none)
-
746  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(b) {}
-
747  fmt(const std::string& f, bg, typo s = typo::none)
-
748  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
-
749  fmt(const std::string& f, typo s = typo::none)
-
750  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
-
753  protected:
-
754 
-
756  std::ostream& print_on( std::ostream& os) const
-
757  {
-
758  if(mode == ansi::colors_16) {
-
759  // Print all in a single escape.
-
760  os << std::make_tuple(fore,back,style);
-
761 
-
762  } else {
-
763  // 256 or 16M: always print separated escapes for foreground/background.
-
764  if(mode == ansi::colors_256) {
-
765  os << fore_256;
-
766  os << back_256;
-
767 
-
768  } else if(mode == ansi::colors_16M) {
-
769  os << fore_16M;
-
770  os << back_16M;
-
771  }
-
772  // In any case, print the style separately.
-
773  os << style;
-
774  }
-
775  return os;
-
776  }
-
777 
-
778  public:
-
790  friend std::ostream& operator<<(std::ostream& os, const fmt& fmt)
-
791  {
-
792  return fmt.print_on(os);
-
793  }
-
794 
-
805  std::string operator()( const std::string& msg ) const
-
806  {
-
807  std::ostringstream os;
-
808  this->print_on(os);
-
809  fmt reset(fmt::typo::reset);
-
810  os << msg;
-
811  reset.print_on(os);
-
812  return os.str();
-
813  }
-
814 
-
817  std::string str() const
-
818  {
-
819  std::ostringstream os;
-
820  this->print_on(os);
-
821  return os.str();
-
822  }
-
823 
-
824  static fmt hash( const std::string& str, const std::vector<fmt> domain = {})
-
825  {
-
826  size_t h = std::hash<std::string>{}(str);
-
827  if(domain.size() == 0) {
-
828  return fmt(static_cast<short>(h % 256));
-
829  } else {
-
830  return fmt(domain[h % domain.size()]);
-
831  }
-
832  }
-
833  }; // fmt class
-
834 
-
840  public:
-
841  clutchlog(clutchlog const&) = delete;
-
842  void operator=(clutchlog const&) = delete;
-
843 
-
844  private:
-
845  clutchlog() :
-
846  // system, main, log
-
847  _strip_calls(clutchlog::default_strip_calls),
-
848  _level_word({
-
849  {level::critical,"Critical"},
-
850  {level::error ,"Error"},
-
851  {level::warning ,"Warning"},
-
852  {level::progress,"Progress"},
-
853  {level::note ,"Note"},
-
854  {level::info ,"Info"},
-
855  {level::debug ,"Debug"},
-
856  {level::xdebug ,"XDebug"}
-
857  }),
-
858  _level_short({
-
859  {level::critical, "Crit"},
-
860  {level::error , "Erro"},
-
861  {level::warning , "Warn"},
-
862  {level::progress, "Prog"},
-
863  {level::note , "Note"},
-
864  {level::info , "Info"},
-
865  {level::debug , "Dbug"},
-
866  {level::xdebug , "XDbg"}
-
867  }),
-
868  _level_fmt({
-
869  {level::critical,fmt(fmt::fg::red, fmt::typo::underline)},
-
870  {level::error ,fmt(fmt::fg::red, fmt::typo::bold)},
-
871  {level::warning ,fmt(fmt::fg::magenta, fmt::typo::bold)},
-
872  {level::progress,fmt()},
-
873  {level::note ,fmt()},
-
874  {level::info ,fmt()},
-
875  {level::debug ,fmt()},
-
876  {level::xdebug ,fmt()}
-
877  }),
-
878  _format_log(clutchlog::default_format),
-
879  _format_dump(clutchlog::dump_default_format),
-
880  #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
-
881  _hfill_char(clutchlog::default_hfill_char),
-
882  _hfill_fmt(fmt::fg::none),
-
883  _hfill_max(clutchlog::default_hfill_max),
-
884  _hfill_min(clutchlog::default_hfill_min),
-
885  #endif
-
886  _out(&std::clog),
-
887  #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
888  _depth(std::numeric_limits<size_t>::max() - _strip_calls),
-
889  _depth_mark(clutchlog::default_depth_mark),
-
890  #endif
-
891  _stage(level::error),
-
892  _in_file(".*"),
-
893  _in_func(".*"),
-
894  _in_line(".*")
-
895  // Empty vectors by default:
-
896  // _filehash_fmts
-
897  // _funchash_fmts
-
898  // _depth_fmts
-
899  {
-
900  // Reverse the level->word map into a word->level map.
-
901  for(auto& lw : _level_word) {
-
902  _word_level[lw.second] = lw.first;
-
903  }
-
904 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
-
905  struct winsize w;
-
906  ioctl(STDERR_FILENO, TIOCGWINSZ, &w);
-
907  _nb_columns = std::max(std::min((size_t)w.ws_col, default_hfill_max), default_hfill_min);
-
908 #endif
-
909  }
-
910 
-
911  protected:
-
913  size_t _strip_calls;
-
915  const std::map<level,std::string> _level_word;
-
917  std::map<std::string,level> _word_level;
-
919  std::map<level,std::string> _level_short;
-
921  std::map<level,fmt> _level_fmt;
-
923  std::string _format_log;
-
925  std::string _format_dump;
-
926  #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
-
927 
-
928  char _hfill_char;
-
930  fmt _hfill_fmt;
-
932  size_t _hfill_max;
-
934  size_t _hfill_min;
-
935  #endif
-
936 
-
937  std::ostream* _out;
-
938  #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
939 
-
940  size_t _depth;
-
942  std::string _depth_mark;
-
943  #endif
-
944 
-
945  level _stage;
-
947  std::regex _in_file;
-
949  std::regex _in_func;
-
951  std::regex _in_line;
-
952 
-
954  std::vector<fmt> _filehash_fmts;
-
956  std::vector<fmt> _funchash_fmts;
-
957 
-
958 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
959 
-
960  static const size_t _max_buffer = 4096;
-
962  std::vector<fmt> _depth_fmts;
-
963 #endif
-
964 
-
965 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
-
966 
-
967  size_t _nb_columns;
-
968 #endif
-
969 
-
971  public:
-
972 
-
976  void format(const std::string& format) {_format_log = format;}
-
979  std::string format() const {return _format_log;}
-
980 
-
982  void format_comment(const std::string& format) {_format_dump = format;}
-
984  std::string format_comment() const {return _format_dump;}
-
985 
-
987  void out(std::ostream& out) {_out = &out;}
-
989  std::ostream& out() {return *_out;}
-
990 
-
991 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
992  void depth(size_t d) {_depth = d;}
-
995  size_t depth() const {return _depth;}
-
996 
-
998  void depth_mark(const std::string mark) {_depth_mark = mark;}
-
1000  std::string depth_mark() const {return _depth_mark;}
-
1001 
-
1003  void strip_calls(const size_t n) {_strip_calls = n;}
-
1005  size_t strip_calls() const {return _strip_calls;}
-
1006 #endif
-
1007 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL == 1
-
1008  void hfill_mark(const char mark) {_hfill_char = mark;}
-
1011  char hfill_mark() const {return _hfill_char;}
-
1013  void hfill_style(fmt style) {_hfill_fmt = style;}
-
1018  template<class ... FMT>
-
1019  void hfill_style(FMT... styles) { this->hfill_style(fmt(styles...)); }
-
1021  fmt hfill_style() const {return _hfill_fmt;}
-
1023  void hfill_max(const size_t nmax) {_hfill_max = nmax;}
-
1025  size_t hfill_max() {return _hfill_max;}
-
1027  void hfill_min(const size_t nmin) {_hfill_min = nmin;}
-
1029  size_t hfill_min() {return _hfill_min;}
-
1030 #endif
-
1031 
-
1038  void filehash_styles(std::vector<fmt> styles) {_filehash_fmts = styles;}
-
1046  void funchash_styles(std::vector<fmt> styles) {_funchash_fmts = styles;}
-
1055  void depth_styles(std::vector<fmt> styles) {_depth_fmts = styles;}
-
1056 
-
1058  void threshold(level l) {_stage = l;}
-
1060  void threshold(const std::string& l) {_stage = this->level_of(l);}
-
1062  level threshold() const {return _stage;}
-
1064  const std::map<std::string,level>& levels() const { return _word_level;}
-
1065 
-
1070  level level_of(const std::string name)
-
1071  {
-
1072  const auto ilevel = _word_level.find(name);
-
1073  if( ilevel != std::end(_word_level)) {
-
1074  return ilevel->second;
-
1075  } else {
-
1076  throw std::out_of_range("'" + name + "' is not a valid log level name");
-
1077  }
-
1078  }
-
1079 
-
1081  void file(std::string file) {_in_file = file;}
-
1083  void func(std::string func) {_in_func = func;}
-
1085  void line(std::string line) {_in_line = line;}
+
742  fmt(const short fr, const short fg, const short fb,
+
743  typo s = typo::none)
+
744  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
+
745 
+
746  fmt(const std::string& f, const std::string& b, typo s = typo::none)
+
747  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(b) {}
+
748  fmt(fg, const std::string& b, typo s = typo::none)
+
749  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(b) {}
+
750  fmt(const std::string& f, bg, typo s = typo::none)
+
751  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
+
752  fmt(const std::string& f, typo s = typo::none)
+
753  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
+
756  protected:
+
757 
+
759  std::ostream& print_on( std::ostream& os) const
+
760  {
+
761  if(mode == ansi::colors_16) {
+
762  // Print all in a single escape.
+
763  os << std::make_tuple(fore,back,style);
+
764 
+
765  } else {
+
766  // 256 or 16M: always print separated escapes for foreground/background.
+
767  if(mode == ansi::colors_256) {
+
768  os << fore_256;
+
769  os << back_256;
+
770 
+
771  } else if(mode == ansi::colors_16M) {
+
772  os << fore_16M;
+
773  os << back_16M;
+
774  }
+
775  // In any case, print the style separately.
+
776  os << style;
+
777  }
+
778  return os;
+
779  }
+
780 
+
781  public:
+
793  friend std::ostream& operator<<(std::ostream& os, const fmt& fmt)
+
794  {
+
795  return fmt.print_on(os);
+
796  }
+
797 
+
808  std::string operator()( const std::string& msg ) const
+
809  {
+
810  std::ostringstream os;
+
811  this->print_on(os);
+
812  fmt reset(fmt::typo::reset);
+
813  os << msg;
+
814  reset.print_on(os);
+
815  return os.str();
+
816  }
+
817 
+
820  std::string str() const
+
821  {
+
822  std::ostringstream os;
+
823  this->print_on(os);
+
824  return os.str();
+
825  }
+
826 
+
827  static fmt hash( const std::string& str, const std::vector<fmt> domain = {})
+
828  {
+
829  size_t h = std::hash<std::string>{}(str);
+
830  if(domain.size() == 0) {
+
831  return fmt(static_cast<short>(h % 256));
+
832  } else {
+
833  return fmt(domain[h % domain.size()]);
+
834  }
+
835  }
+
836  }; // fmt class
+
837 
+
843  public:
+
844  clutchlog(clutchlog const&) = delete;
+
845  void operator=(clutchlog const&) = delete;
+
846 
+
847  private:
+
848  clutchlog() :
+
849  // system, main, log
+
850  _strip_calls(clutchlog::default_strip_calls),
+
851  _level_word({
+
852  {level::critical,"Critical"},
+
853  {level::error ,"Error"},
+
854  {level::warning ,"Warning"},
+
855  {level::progress,"Progress"},
+
856  {level::note ,"Note"},
+
857  {level::info ,"Info"},
+
858  {level::debug ,"Debug"},
+
859  {level::xdebug ,"XDebug"}
+
860  }),
+
861  _level_short({
+
862  {level::critical, "Crit"},
+
863  {level::error , "Erro"},
+
864  {level::warning , "Warn"},
+
865  {level::progress, "Prog"},
+
866  {level::note , "Note"},
+
867  {level::info , "Info"},
+
868  {level::debug , "Dbug"},
+
869  {level::xdebug , "XDbg"}
+
870  }),
+
871  _level_fmt({
+
872  {level::critical,fmt(fmt::fg::red, fmt::typo::underline)},
+
873  {level::error ,fmt(fmt::fg::red, fmt::typo::bold)},
+
874  {level::warning ,fmt(fmt::fg::magenta, fmt::typo::bold)},
+
875  {level::progress,fmt()},
+
876  {level::note ,fmt()},
+
877  {level::info ,fmt()},
+
878  {level::debug ,fmt()},
+
879  {level::xdebug ,fmt()}
+
880  }),
+
881  _format_log(clutchlog::default_format),
+
882  _format_dump(clutchlog::dump_default_format),
+
883  #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
+
884  _hfill_char(clutchlog::default_hfill_char),
+
885  _hfill_fmt(fmt::fg::none),
+
886  _hfill_max(clutchlog::default_hfill_max),
+
887  _hfill_min(clutchlog::default_hfill_min),
+
888  #endif
+
889  _out(&std::clog),
+
890  #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
891  _depth(std::numeric_limits<size_t>::max() - _strip_calls),
+
892  _depth_mark(clutchlog::default_depth_mark),
+
893  #endif
+
894  _stage(level::error),
+
895  _in_file(".*"),
+
896  _in_func(".*"),
+
897  _in_line(".*"),
+
898  // Empty vectors by default:
+
899  // _filehash_fmts
+
900  // _funchash_fmts
+
901  // _depth_fmts
+
902  _filename(filename::path)
+
903  {
+
904  // Reverse the level->word map into a word->level map.
+
905  for(auto& lw : _level_word) {
+
906  _word_level[lw.second] = lw.first;
+
907  }
+
908 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
+
909  struct winsize w;
+
910  ioctl(STDERR_FILENO, TIOCGWINSZ, &w);
+
911  _nb_columns = std::max(std::min((size_t)w.ws_col, default_hfill_max), default_hfill_min);
+
912 #endif
+
913  }
+
914 
+
915  protected:
+
917  size_t _strip_calls;
+
919  const std::map<level,std::string> _level_word;
+
921  std::map<std::string,level> _word_level;
+
923  std::map<level,std::string> _level_short;
+
925  std::map<level,fmt> _level_fmt;
+
927  std::string _format_log;
+
929  std::string _format_dump;
+
930  #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
+
931 
+
932  char _hfill_char;
+
934  fmt _hfill_fmt;
+
936  size_t _hfill_max;
+
938  size_t _hfill_min;
+
939  #endif
+
940 
+
941  std::ostream* _out;
+
942  #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
943 
+
944  size_t _depth;
+
946  std::string _depth_mark;
+
947  #endif
+
948 
+
949  level _stage;
+
951  std::regex _in_file;
+
953  std::regex _in_func;
+
955  std::regex _in_line;
+
956 
+
958  std::vector<fmt> _filehash_fmts;
+
960  std::vector<fmt> _funchash_fmts;
+
961 
+
962 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
963 
+
964  static const size_t _max_buffer = 4096;
+
966  std::vector<fmt> _depth_fmts;
+
967 #endif
+
968 
+
969 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
+
970 
+
971  size_t _nb_columns;
+
972 #endif
+
973 
+
975  filename _filename;
+
978  public:
+
979 
+
983  void format(const std::string& format) {_format_log = format;}
+
986  std::string format() const {return _format_log;}
+
987 
+
989  void format_comment(const std::string& format) {_format_dump = format;}
+
991  std::string format_comment() const {return _format_dump;}
+
992 
+
994  void out(std::ostream& out) {_out = &out;}
+
996  std::ostream& out() {return *_out;}
+
997 
+
998 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
999  void depth(size_t d) {_depth = d;}
+
1002  size_t depth() const {return _depth;}
+
1003 
+
1005  void depth_mark(const std::string mark) {_depth_mark = mark;}
+
1007  std::string depth_mark() const {return _depth_mark;}
+
1008 
+
1010  void strip_calls(const size_t n) {_strip_calls = n;}
+
1012  size_t strip_calls() const {return _strip_calls;}
+
1013 #endif
+
1014 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL == 1
+
1015  void hfill_mark(const char mark) {_hfill_char = mark;}
+
1018  char hfill_mark() const {return _hfill_char;}
+
1020  void hfill_style(fmt style) {_hfill_fmt = style;}
+
1025  template<class ... FMT>
+
1026  void hfill_style(FMT... styles) { this->hfill_style(fmt(styles...)); }
+
1028  fmt hfill_style() const {return _hfill_fmt;}
+
1030  void hfill_max(const size_t nmax) {_hfill_max = nmax;}
+
1032  size_t hfill_max() {return _hfill_max;}
+
1034  void hfill_min(const size_t nmin) {_hfill_min = nmin;}
+
1036  size_t hfill_min() {return _hfill_min;}
+
1037 #endif
+
1038 
+
1045  void filehash_styles(std::vector<fmt> styles) {_filehash_fmts = styles;}
+
1053  void funchash_styles(std::vector<fmt> styles) {_funchash_fmts = styles;}
+
1062  void depth_styles(std::vector<fmt> styles) {_depth_fmts = styles;}
+
1063 
+
1065  void threshold(level l) {_stage = l;}
+
1067  void threshold(const std::string& l) {_stage = this->level_of(l);}
+
1069  level threshold() const {return _stage;}
+
1071  const std::map<std::string,level>& levels() const { return _word_level;}
+
1072 
+
1077  level level_of(const std::string name)
+
1078  {
+
1079  const auto ilevel = _word_level.find(name);
+
1080  if( ilevel != std::end(_word_level)) {
+
1081  return ilevel->second;
+
1082  } else {
+
1083  throw std::out_of_range("'" + name + "' is not a valid log level name");
+
1084  }
+
1085  }
1086 
-
1088  void location(
-
1089  const std::string& in_file,
-
1090  const std::string& in_function=".*",
-
1091  const std::string& in_line=".*"
-
1092  )
-
1093  {
-
1094  file(in_file);
-
1095  func(in_function);
-
1096  line(in_line);
-
1097  }
-
1098 
-
1103  template<class ... FMT>
-
1104  void style(level stage, FMT... styles) { this->style(stage,fmt(styles...)); }
-
1106  void style(level stage, fmt style) { _level_fmt.at(stage) = style; }
-
1108  fmt style(level stage) const { return _level_fmt.at(stage); }
-
1109 
-
1112  public:
-
1113 
-
1117  struct scope_t {
-
1120  bool matches;
-
1122  level stage;
-
1123 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1124 
-
1125  size_t depth;
-
1126 #endif
-
1127 
-
1128  bool there;
-
1130  scope_t() :
-
1131  matches(false),
-
1132  stage(level::xdebug),
-
1133 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1134  depth(0),
-
1135 #endif
-
1136  there(false)
-
1137  {}
-
1138  }; // scope_t
-
1139 
-
1140 
-
1142  scope_t locate(
-
1143  const level& stage,
-
1144  const std::string& file,
-
1145  const std::string& func,
-
1146  const size_t line
-
1147  ) const
-
1148  {
-
1149  scope_t scope; // False scope by default.
+
1088  void file(std::string file) {_in_file = file;}
+
1090  void func(std::string func) {_in_func = func;}
+
1092  void line(std::string line) {_in_line = line;}
+
1093 
+
1095  void location(
+
1096  const std::string& in_file,
+
1097  const std::string& in_function=".*",
+
1098  const std::string& in_line=".*"
+
1099  )
+
1100  {
+
1101  file(in_file);
+
1102  func(in_function);
+
1103  line(in_line);
+
1104  }
+
1105 
+
1110  template<class ... FMT>
+
1111  void style(level stage, FMT... styles) { this->style(stage,fmt(styles...)); }
+
1113  void style(level stage, fmt style) { _level_fmt.at(stage) = style; }
+
1115  fmt style(level stage) const { return _level_fmt.at(stage); }
+
1116 
+
1118  void filename(filename f) {_filename = f;}
+
1119 
+
1122  public:
+
1123 
+
1127  struct scope_t {
+
1130  bool matches;
+
1132  level stage;
+
1133 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1134 
+
1135  size_t depth;
+
1136 #endif
+
1137 
+
1138  bool there;
+
1140  scope_t() :
+
1141  matches(false),
+
1142  stage(level::xdebug),
+
1143 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1144  depth(0),
+
1145 #endif
+
1146  there(false)
+
1147  {}
+
1148  }; // scope_t
+
1149 
1150 
-
1151  /***** Log level stage *****/
-
1152  // Test stage first, because it's fastest.
-
1153  scope.stage = stage;
-
1154  if(not (scope.stage <= _stage)) {
-
1155  // Bypass useless computations if no match
-
1156  // because of the stage.
-
1157  return scope;
-
1158  }
-
1159 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1160  /***** Stack depth *****/
-
1161  // Backtrace in second, quite fast.
-
1162  size_t stack_depth;
-
1163  void *buffer[_max_buffer];
-
1164  stack_depth = backtrace(buffer, _max_buffer);
-
1165  scope.depth = stack_depth;
-
1166  if(not (scope.depth <= _depth + _strip_calls)) {
-
1167  // Bypass if no match.
-
1168  return scope;
-
1169  }
-
1170 #endif
-
1171 
-
1172  /***** Location *****/
-
1173  // Location last, slowest.
-
1174  std::ostringstream sline; sline << line;
-
1175  scope.there =
-
1176  std::regex_search(file, _in_file)
-
1177  and std::regex_search(func, _in_func)
-
1178  and std::regex_search(sline.str(), _in_line);
-
1179 
-
1180  // No need to retest stage and depth, which are true here.
-
1181  scope.matches = scope.there;
-
1182 
-
1183  return scope;
-
1184  } // locate
-
1185 
-
1193  std::string replace(
-
1194  const std::string& form,
-
1195  const std::string& mark,
-
1196  const std::string& tag
-
1197  ) const
-
1198  {
-
1199  // Useless debug code, unless something fancy would be done with name tags.
-
1200  // std::regex re;
-
1201  // try {
-
1202  // re = std::regex(mark);
-
1203  //
-
1204  // } catch(const std::regex_error& e) {
-
1205  // std::cerr << "ERROR with a regular expression \"" << mark << "\": ";
-
1206  // switch(e.code()) {
-
1207  // case std::regex_constants::error_collate:
-
1208  // std::cerr << "the expression contains an invalid collating element name";
-
1209  // break;
-
1210  // case std::regex_constants::error_ctype:
-
1211  // std::cerr << "the expression contains an invalid character class name";
-
1212  // break;
-
1213  // case std::regex_constants::error_escape:
-
1214  // std::cerr << "the expression contains an invalid escaped character or a trailing escape";
-
1215  // break;
-
1216  // case std::regex_constants::error_backref:
-
1217  // std::cerr << "the expression contains an invalid back reference";
-
1218  // break;
-
1219  // case std::regex_constants::error_brack:
-
1220  // std::cerr << "the expression contains mismatched square brackets ('[' and ']')";
-
1221  // break;
-
1222  // case std::regex_constants::error_paren:
-
1223  // std::cerr << "the expression contains mismatched parentheses ('(' and ')')";
-
1224  // break;
-
1225  // case std::regex_constants::error_brace:
-
1226  // std::cerr << "the expression contains mismatched curly braces ('{' and '}')";
-
1227  // break;
-
1228  // case std::regex_constants::error_badbrace:
-
1229  // std::cerr << "the expression contains an invalid range in a {} expression";
-
1230  // break;
-
1231  // case std::regex_constants::error_range:
-
1232  // std::cerr << "the expression contains an invalid character range (e.g. [b-a])";
-
1233  // break;
-
1234  // case std::regex_constants::error_space:
-
1235  // std::cerr << "there was not enough memory to convert the expression into a finite state machine";
-
1236  // break;
-
1237  // case std::regex_constants::error_badrepeat:
-
1238  // std::cerr << "one of *?+{ was not preceded by a valid regular expression";
-
1239  // break;
-
1240  // case std::regex_constants::error_complexity:
-
1241  // std::cerr << "the complexity of an attempted match exceeded a predefined level";
-
1242  // break;
-
1243  // case std::regex_constants::error_stack:
-
1244  // std::cerr << "there was not enough memory to perform a match";
-
1245  // break;
-
1246  // default:
-
1247  // std::cerr << "unknown error";
-
1248  // }
-
1249  // std::cerr << std::endl;
-
1250  // throw;
-
1251  // } // catch
-
1252 
-
1253  const std::regex re(mark);
-
1254  return std::regex_replace(form, re, tag);
-
1255  }
-
1256 
-
1258  std::string replace(
-
1259  const std::string& form,
-
1260  const std::string& mark,
-
1261  const size_t tag
-
1262  ) const
-
1263  {
-
1264  std::ostringstream stag; stag << tag;
-
1265  return replace(form, mark, stag.str());
-
1266  }
-
1267 
-
1269  std::string format(
-
1270  std::string row,
-
1271  const std::string& what,
-
1272 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1273  const std::string& name,
-
1274 #endif
-
1275  const level& stage,
-
1276  const std::string& file,
-
1277  const std::string& func,
-
1278  const size_t line
-
1279 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1280  ,
-
1281  const size_t depth
-
1282 #endif
-
1283  ) const
-
1284  {
-
1285  row = replace(row, "\\{msg\\}", what);
-
1286  row = replace(row, "\\{file\\}", file);
-
1287  row = replace(row, "\\{func\\}", func);
-
1288  row = replace(row, "\\{line\\}", line);
-
1289 
-
1290  row = replace(row, "\\{level\\}", _level_word.at(stage));
-
1291  std::string letter(1, _level_word.at(stage).at(0)); // char -> string
-
1292  row = replace(row, "\\{level_letter\\}", letter);
-
1293 
-
1294  row = replace(row, "\\{level_short\\}", _level_short.at(stage));
-
1295 
-
1296 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1297  size_t actual_depth = depth - _strip_calls;
-
1298  row = replace(row, "\\{name\\}", name);
-
1299  row = replace(row, "\\{depth\\}", actual_depth);
-
1300 
-
1301  if(_depth_fmts.size() == 0) {
-
1302  row = replace(row, "\\{depth_fmt\\}", fmt(actual_depth % 256).str() );
-
1303 
-
1304  std::ostringstream chevrons;
-
1305  for(size_t i = 0; i < actual_depth; ++i) {
-
1306  chevrons << _depth_mark;
-
1307  }
-
1308  row = replace(row, "\\{depth_marks\\}", chevrons.str());
-
1309 
-
1310  } else {
-
1311  row = replace(row, "\\{depth_fmt\\}",
-
1312  _depth_fmts[std::min(actual_depth,_depth_fmts.size()-1)].str() );
-
1313 
-
1314  std::ostringstream chevrons;
-
1315  for(size_t i = 0; i < actual_depth; ++i) {
-
1316  chevrons << _depth_fmts[std::min(i+1,_depth_fmts.size()-1)].str()
-
1317  << _depth_mark;
-
1318  }
-
1319  row = replace(row, "\\{depth_marks\\}", chevrons.str());
-
1320  }
-
1321 #endif
-
1322  row = replace(row, "\\{level_fmt\\}", _level_fmt.at(stage).str());
-
1323  row = replace(row, "\\{filehash_fmt\\}", fmt::hash(file, _filehash_fmts).str() );
-
1324  row = replace(row, "\\{funchash_fmt\\}", fmt::hash(func, _funchash_fmts).str() );
+
1152  scope_t locate(
+
1153  const level& stage,
+
1154  const std::string& file,
+
1155  const std::string& func,
+
1156  const size_t line
+
1157  ) const
+
1158  {
+
1159  scope_t scope; // False scope by default.
+
1160 
+
1161  /***** Log level stage *****/
+
1162  // Test stage first, because it's fastest.
+
1163  scope.stage = stage;
+
1164  if(not (scope.stage <= _stage)) {
+
1165  // Bypass useless computations if no match
+
1166  // because of the stage.
+
1167  return scope;
+
1168  }
+
1169 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1170  /***** Stack depth *****/
+
1171  // Backtrace in second, quite fast.
+
1172  size_t stack_depth;
+
1173  void *buffer[_max_buffer];
+
1174  stack_depth = backtrace(buffer, _max_buffer);
+
1175  scope.depth = stack_depth;
+
1176  if(not (scope.depth <= _depth + _strip_calls)) {
+
1177  // Bypass if no match.
+
1178  return scope;
+
1179  }
+
1180 #endif
+
1181 
+
1182  /***** Location *****/
+
1183  // Location last, slowest.
+
1184  std::ostringstream sline; sline << line;
+
1185  scope.there =
+
1186  std::regex_search(file, _in_file)
+
1187  and std::regex_search(func, _in_func)
+
1188  and std::regex_search(sline.str(), _in_line);
+
1189 
+
1190  // No need to retest stage and depth, which are true here.
+
1191  scope.matches = scope.there;
+
1192 
+
1193  return scope;
+
1194  } // locate
+
1195 
+
1203  std::string replace(
+
1204  const std::string& form,
+
1205  const std::string& mark,
+
1206  const std::string& tag
+
1207  ) const
+
1208  {
+
1209  // Useless debug code, unless something fancy would be done with name tags.
+
1210  // std::regex re;
+
1211  // try {
+
1212  // re = std::regex(mark);
+
1213  //
+
1214  // } catch(const std::regex_error& e) {
+
1215  // std::cerr << "ERROR with a regular expression \"" << mark << "\": ";
+
1216  // switch(e.code()) {
+
1217  // case std::regex_constants::error_collate:
+
1218  // std::cerr << "the expression contains an invalid collating element name";
+
1219  // break;
+
1220  // case std::regex_constants::error_ctype:
+
1221  // std::cerr << "the expression contains an invalid character class name";
+
1222  // break;
+
1223  // case std::regex_constants::error_escape:
+
1224  // std::cerr << "the expression contains an invalid escaped character or a trailing escape";
+
1225  // break;
+
1226  // case std::regex_constants::error_backref:
+
1227  // std::cerr << "the expression contains an invalid back reference";
+
1228  // break;
+
1229  // case std::regex_constants::error_brack:
+
1230  // std::cerr << "the expression contains mismatched square brackets ('[' and ']')";
+
1231  // break;
+
1232  // case std::regex_constants::error_paren:
+
1233  // std::cerr << "the expression contains mismatched parentheses ('(' and ')')";
+
1234  // break;
+
1235  // case std::regex_constants::error_brace:
+
1236  // std::cerr << "the expression contains mismatched curly braces ('{' and '}')";
+
1237  // break;
+
1238  // case std::regex_constants::error_badbrace:
+
1239  // std::cerr << "the expression contains an invalid range in a {} expression";
+
1240  // break;
+
1241  // case std::regex_constants::error_range:
+
1242  // std::cerr << "the expression contains an invalid character range (e.g. [b-a])";
+
1243  // break;
+
1244  // case std::regex_constants::error_space:
+
1245  // std::cerr << "there was not enough memory to convert the expression into a finite state machine";
+
1246  // break;
+
1247  // case std::regex_constants::error_badrepeat:
+
1248  // std::cerr << "one of *?+{ was not preceded by a valid regular expression";
+
1249  // break;
+
1250  // case std::regex_constants::error_complexity:
+
1251  // std::cerr << "the complexity of an attempted match exceeded a predefined level";
+
1252  // break;
+
1253  // case std::regex_constants::error_stack:
+
1254  // std::cerr << "there was not enough memory to perform a match";
+
1255  // break;
+
1256  // default:
+
1257  // std::cerr << "unknown error";
+
1258  // }
+
1259  // std::cerr << std::endl;
+
1260  // throw;
+
1261  // } // catch
+
1262 
+
1263  const std::regex re(mark);
+
1264  return std::regex_replace(form, re, tag);
+
1265  }
+
1266 
+
1268  std::string replace(
+
1269  const std::string& form,
+
1270  const std::string& mark,
+
1271  const size_t tag
+
1272  ) const
+
1273  {
+
1274  std::ostringstream stag; stag << tag;
+
1275  return replace(form, mark, stag.str());
+
1276  }
+
1277 
+
1279  std::string format(
+
1280  std::string row,
+
1281  const std::string& what,
+
1282 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1283  const std::string& name,
+
1284 #endif
+
1285  const level& stage,
+
1286  const std::string& file,
+
1287  const std::string& func,
+
1288  const size_t line
+
1289 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1290  ,
+
1291  const size_t depth
+
1292 #endif
+
1293  ) const
+
1294  {
+
1295  row = replace(row, "\\{msg\\}", what);
+
1296 
+
1297  const std::filesystem::path filepath(file);
+
1298  assert(filepath.is_absolute());
+
1299  std::string filename;
+
1300  std::filesystem::path::iterator ip = filepath.end();
+
1301  std::advance(ip, -2);
+
1302  switch(_filename) {
+
1303  case filename::base:
+
1304  filename = filepath.filename().string();
+
1305  break;
+
1306  case filename::dir:
+
1307  filename = ip->string();
+
1308  break;
+
1309  case filename::dirbase:
+
1310  filename = (*ip / filepath.filename()).string();
+
1311  break;
+
1312  case filename::stem:
+
1313  filename = filepath.stem().string();
+
1314  break;
+
1315  case filename::dirstem:
+
1316  filename = (*ip / filepath.stem()).string();
+
1317  break;
+
1318  case filename::path:
+
1319  default:
+
1320  filename = file;
+
1321  break;
+
1322  }
+
1323  row = replace(row, "\\{file\\}", filename);
+
1324 
1325 
-
1326 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
-
1327  // hfill is replaced last to allow for correct line width estimation.
-
1328  const std::string raw_row = replace(row, "\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "");
-
1329  const std::string hfill_tag = "{hfill}";
-
1330  const size_t hfill_pos = row.find(hfill_tag);
-
1331  const size_t raw_hfill_pos = raw_row.find(hfill_tag);
-
1332  const size_t nb_columns = std::max(std::min((size_t)_nb_columns, _hfill_max), _hfill_min);
-
1333  if(hfill_pos != std::string::npos) {
-
1334  assert(raw_hfill_pos != std::string::npos);
-
1335  if(nb_columns > 0) {
-
1336  const size_t left_len = raw_hfill_pos;
-
1337  const size_t right_len = raw_row.size() - raw_hfill_pos - hfill_tag.size();
-
1338  if(right_len+left_len > nb_columns) {
-
1339  // The right part would go over the terminal width: add a new row.
-
1340  if(right_len < nb_columns) {
-
1341  // There is room for the right part on a new line.
-
1342  const std::string hfill(std::max((size_t)0, nb_columns-right_len), _hfill_char);
-
1343  const std::string hfill_styled = _hfill_fmt(hfill);
-
1344  row = replace(row, "\\{hfill\\}", "\n"+hfill_styled);
-
1345  } else {
-
1346  // Right part still goes over columns: let it go.
-
1347  const std::string hfill(1, _hfill_char);
-
1348  const std::string hfill_styled = _hfill_fmt(hfill);
-
1349  row = replace(row, "\\{hfill\\}", "\n"+hfill_styled);
-
1350  }
-
1351  } else {
-
1352  // There is some space in between left and right parts.
-
1353  const std::string hfill(std::max((size_t)0, nb_columns - (right_len+left_len)), _hfill_char);
-
1354  const std::string hfill_styled = _hfill_fmt(hfill);
-
1355  row = replace(row, "\\{hfill\\}", hfill_styled);
-
1356  }
-
1357  } else {
-
1358  // We don't know the terminal width.
-
1359  const std::string hfill(1, _hfill_char);
-
1360  const std::string hfill_styled = _hfill_fmt(hfill);
-
1361  row = replace(row, "\\{hfill\\}", hfill_styled);
-
1362  }
-
1363  }
-
1364 #else
-
1365  // We cannot know the terminal width.
-
1366  const std::string hfill(1, _hfill_char);
-
1367  const std::string hfill_styled = _hfill_fmt(hfill);
-
1368  row = replace(row, "\\{hfill\\}", hfill_styled);
-
1369 #endif
-
1370  return _level_fmt.at(stage)(row);
-
1371  }
-
1372 
-
1374  void log(
-
1375  const level& stage,
-
1376  const std::string& what,
-
1377  const std::string& file, const std::string& func, const size_t line,
-
1378  const size_t depth_delta = 0
-
1379  ) const
-
1380  {
-
1381  scope_t scope = locate(stage, file, func, line);
-
1382 
-
1383  if(scope.matches) {
-
1384 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1385  *_out << format(_format_log, what, basename(getenv("_")),
-
1386  stage, file, func,
-
1387  line, scope.depth + depth_delta );
-
1388 #else
-
1389  *_out << format(_format_log, what,
-
1390  stage, file, func,
-
1391  line );
-
1392 #endif
-
1393  _out->flush();
-
1394  } // if scopes.matches
-
1395  }
-
1396 
-
1398  template<class In>
-
1399  void dump(
-
1400  const level& stage,
-
1401  const In container_begin, const In container_end,
-
1402  const std::string& file, const std::string& func, const size_t line,
-
1403  const std::string& filename_template = "dump_{n}.dat",
-
1404  const std::string sep = dump_default_sep
-
1405  ) const
-
1406  {
-
1407  scope_t scope = locate(stage, file, func, line);
-
1408 
-
1409  if(scope.matches) {
-
1410  const std::string tag = "\\{n\\}";
-
1411  const std::regex re(tag);
-
1412  std::string outfile = "";
-
1413 
-
1414  // If the file name template has the {n} tag.
-
1415  if(std::regex_search(filename_template, re)) {
-
1416  // Increment n until a free one is found.
-
1417  size_t n = 0;
-
1418  do {
-
1419  outfile = replace(filename_template, tag, n);
-
1420  n++;
-
1421  } while( fs::exists( outfile ) );
-
1422 
-
1423  } else {
-
1424  // Use the parameter as is.
-
1425  outfile = filename_template;
-
1426  }
-
1427 
-
1428  std::ofstream fd(outfile);
-
1429 
-
1430  if(_format_dump.size() > 0) {
-
1431 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1432  fd << format(_format_dump, "", basename(getenv("_")),
-
1433  stage, file, func,
-
1434  line, scope.depth );
-
1435 #else
-
1436  fd << format(_format_dump, "",
-
1437  stage, file, func,
-
1438  line );
-
1439 #endif
-
1440  fd << sep; // sep after comment line.
-
1441  }
-
1442 
-
1443  std::copy(container_begin, container_end,
-
1444  std::ostream_iterator<typename In::value_type>(fd, sep.c_str()));
-
1445 
-
1446  fd.close();
-
1447  } // if scopes.matches
-
1448  }
-
1449 
-
1451 };
-
1452 
-
1455 #else // not WITH_CLUTCHLOG
-
1456 
-
1457 
-
1458 /**********************************************************************
-
1459  * Fake implementation
-
1460  **********************************************************************/
-
1461 
-
1462 // Equivalent class with empty methods, will be optimized out
-
1463 // while allowing to actually have calls implemented without WITH_CLUTCHLOG guards.
-
1464 #pragma GCC diagnostic push
-
1465 #pragma GCC diagnostic ignored "-Wreturn-type"
-
1466 class clutchlog
-
1467 {
-
1468  public:
-
1469  static clutchlog& logger() {}
-
1470  enum level {critical=0, error=1, warning=2, progress=3, note=4, info=5, debug=6, xdebug=7};
-
1471  class fmt {
-
1472  public:
-
1473  enum class ansi { colors_16, colors_256, colors_16M} mode;
-
1474  enum class typo { reset, bold, underline, inverse, none} style;
-
1475  enum class fg { black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white, none} fore;
-
1476  enum class bg { black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white, none } back;
-
1477  protected:
-
1478  friend std::ostream& operator<<(std::ostream&, const std::tuple<fg,bg,typo>&) {}
-
1479  friend std::ostream& operator<<(std::ostream&, const typo&) {}
-
1480  protected:
-
1481  struct color {
-
1482  ansi mode;
-
1483  enum class ground { fore, back } type;
-
1484  color(ansi a, ground g) : mode(a), type(g) {}
-
1485  virtual bool is_set() const = 0;
-
1486  virtual std::ostream& print_on( std::ostream&) const = 0;
-
1487  friend std::ostream& operator<<(std::ostream&, const color&) {}
-
1488  };
-
1489  struct color_256 : public color {
-
1490  short index;
-
1491  color_256(ground t) : color(ansi::colors_256, t), index(-1) {}
-
1492  color_256(ground t, const short i) : color(ansi::colors_256, t), index(i) {}
-
1493  bool is_set() const {}
-
1494  std::ostream& print_on( std::ostream&) const {}
-
1495  };
-
1496  struct fg_256 : public color_256 {
-
1497  fg_256() : color_256(ground::fore) {}
-
1498  fg_256(const short f) : color_256(ground::fore, f) {}
-
1499  fg_256(const fg&) : color_256(ground::fore, -1) {}
-
1500  } fore_256;
-
1501  struct bg_256 : public color_256 {
-
1502  bg_256() : color_256(ground::back) {}
-
1503  bg_256(const short b) : color_256(ground::back, b) {}
-
1504  bg_256(const bg&) : color_256(ground::back, -1) {}
-
1505  } back_256;
-
1506  struct color_16M : public color {
-
1507  short red, green, blue;
-
1508  color_16M(ground t) : color(ansi::colors_16M, t), red(-1), green(-1), blue(-1) {}
-
1509  color_16M(ground t, short r, short g, short b) : color(ansi::colors_16M, t), red(r), green(g), blue(b) {}
-
1510  color_16M(ground t, const std::string&) : color(ansi::colors_16M, t) {}
-
1511  bool is_set() const {return red > -1 and green > -1 and blue > -1;}
-
1512  std::ostream& print_on( std::ostream&) const {}
-
1513  };
-
1514  struct fg_16M : public color_16M {
-
1515  fg_16M() : color_16M(ground::fore) {}
-
1516  fg_16M(short r, short g, short b) : color_16M(ground::fore, r,g,b) {}
-
1517  fg_16M(const std::string& srgb) : color_16M(ground::fore, srgb) {}
-
1518  fg_16M(const fg&) : color_16M(ground::fore, -1,-1,-1) {}
-
1519  } fore_16M;
-
1520  struct bg_16M : public color_16M {
-
1521  bg_16M() : color_16M(ground::back) {}
-
1522  bg_16M(short r, short g, short b) : color_16M(ground::back, r,g,b) {}
-
1523  bg_16M(const std::string& srgb) : color_16M(ground::back, srgb) {}
-
1524  bg_16M(const bg&) : color_16M(ground::back, -1,-1,-1) {}
-
1525  } back_16M;
-
1526  public:
-
1527  fmt() : mode(ansi::colors_16), style(typo::none), fore(fg::none), back(bg::none) {}
-
1528  fmt( fg f, bg b = bg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1529  fmt( fg f, typo s , bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1530  fmt( bg b, fg f = fg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1531  fmt( bg b, typo s , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1532  fmt(typo s, fg f = fg::none, bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1533  fmt(typo s, bg b , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
-
1534  fmt(fg_256 f, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(b) {}
-
1535  fmt(fg_256 f, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(bg::none) {}
-
1536  fmt(fg, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(fg::none), back_256(b) {}
-
1537  fmt(const short fr, const short fg, const short fb,
-
1538  const short gr, const short gg, const short gb,
-
1539  typo s = typo::none)
-
1540  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(gr,gg,gb) {}
-
1541  fmt(fg,
-
1542  const short gr, const short gg, const short gb,
-
1543  typo s = typo::none)
-
1544  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(gr,gg,gb) {}
-
1545  fmt(const short fr, const short fg, const short fb,
-
1546  bg, typo s = typo::none)
-
1547  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
-
1548  fmt(const short fr, const short fg, const short fb,
-
1549  typo s = typo::none)
-
1550  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
-
1551 
-
1552  fmt(const std::string& f, const std::string& b, typo s = typo::none)
-
1553  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(b) {}
-
1554  fmt(fg, const std::string& b, typo s = typo::none)
-
1555  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(b) {}
-
1556  fmt(const std::string& f, bg, typo s = typo::none)
-
1557  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
-
1558  fmt(const std::string& f, typo s = typo::none)
-
1559  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
-
1560  protected:
-
1561  std::ostream& print_on( std::ostream&) const {}
-
1562  public:
-
1563  friend std::ostream& operator<<(std::ostream&, const fmt&) {}
-
1564  std::string operator()( const std::string&) const {}
-
1565  std::string str() const {}
-
1566  static fmt hash( const std::string&, const std::vector<fmt>) {}
-
1567  };
-
1568  public:
-
1569  clutchlog(clutchlog const&) = delete;
-
1570  void operator=(clutchlog const&) = delete;
-
1571  private:
-
1572  clutchlog() {}
-
1573  protected:
-
1574  struct scope_t {};
-
1575  scope_t locate(
-
1576  const level&,
-
1577  const std::string&,
-
1578  const std::string&,
-
1579  const size_t
-
1580  ) const
-
1581  {}
-
1582  public:
-
1583  void format(const std::string&) {}
-
1584  std::string format() const {}
-
1585 
-
1586  void format_comment(const std::string&) {}
-
1587  std::string format_comment() const {}
-
1588 
-
1589  void out(std::ostream&) {}
-
1590  std::ostream& out() {}
-
1591 
-
1592 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1593  void depth(size_t) {}
-
1594  size_t depth() const {}
-
1595 
-
1596  void depth_mark(const std::string) {}
-
1597  std::string depth_mark() const {}
-
1598  void strip_calls(const size_t) {}
-
1599  size_t strip_calls() const {}
-
1600 #endif
-
1601 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL == 1
-
1602  void hfill_mark(const char) {}
-
1603  char hfill_mark() const {}
-
1604  void hfill_fmt(fmt) {}
-
1605  fmt hfill_fmt() const {}
-
1606  void hfill_min(const size_t) {}
-
1607  size_t hfill_min() {}
-
1608  void hfill_max(const size_t) {}
-
1609  size_t hfill_max() {}
-
1610 #endif
-
1611  void filehash_styles(std::vector<fmt> ) {}
-
1612  void funchash_styles(std::vector<fmt> ) {}
-
1613  void depth_styles(std::vector<fmt>) {}
-
1614 
-
1615  void threshold(level) {}
-
1616  void threshold(const std::string&) {}
-
1617  level threshold() const {}
-
1618  const std::map<std::string,level> levels() const {}
-
1619  level level_of(const std::string) {}
-
1620 
-
1621  void file(std::string) {}
-
1622  void func(std::string) {}
-
1623  void line(std::string) {}
+
1326  row = replace(row, "\\{func\\}", func);
+
1327  row = replace(row, "\\{line\\}", line);
+
1328 
+
1329  row = replace(row, "\\{level\\}", _level_word.at(stage));
+
1330  std::string letter(1, _level_word.at(stage).at(0)); // char -> string
+
1331  row = replace(row, "\\{level_letter\\}", letter);
+
1332  row = replace(row, "\\{level_short\\}", _level_short.at(stage));
+
1333 
+
1334 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1335  size_t actual_depth = depth - _strip_calls;
+
1336  row = replace(row, "\\{name\\}", name);
+
1337  row = replace(row, "\\{depth\\}", actual_depth);
+
1338 
+
1339  if(_depth_fmts.size() == 0) {
+
1340  row = replace(row, "\\{depth_fmt\\}", fmt(actual_depth % 256).str() );
+
1341 
+
1342  std::ostringstream chevrons;
+
1343  for(size_t i = 0; i < actual_depth; ++i) {
+
1344  chevrons << _depth_mark;
+
1345  }
+
1346  row = replace(row, "\\{depth_marks\\}", chevrons.str());
+
1347 
+
1348  } else {
+
1349  row = replace(row, "\\{depth_fmt\\}",
+
1350  _depth_fmts[std::min(actual_depth,_depth_fmts.size()-1)].str() );
+
1351 
+
1352  std::ostringstream chevrons;
+
1353  for(size_t i = 0; i < actual_depth; ++i) {
+
1354  chevrons << _depth_fmts[std::min(i+1,_depth_fmts.size()-1)].str()
+
1355  << _depth_mark;
+
1356  }
+
1357  row = replace(row, "\\{depth_marks\\}", chevrons.str());
+
1358  }
+
1359 #endif
+
1360  row = replace(row, "\\{level_fmt\\}", _level_fmt.at(stage).str());
+
1361  row = replace(row, "\\{filehash_fmt\\}", fmt::hash(file, _filehash_fmts).str() );
+
1362  row = replace(row, "\\{funchash_fmt\\}", fmt::hash(func, _funchash_fmts).str() );
+
1363 
+
1364 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL
+
1365  // hfill is replaced last to allow for correct line width estimation.
+
1366  const std::string raw_row = replace(row, "\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "");
+
1367  const std::string hfill_tag = "{hfill}";
+
1368  const size_t hfill_pos = row.find(hfill_tag);
+
1369  const size_t raw_hfill_pos = raw_row.find(hfill_tag);
+
1370  const size_t nb_columns = std::max(std::min((size_t)_nb_columns, _hfill_max), _hfill_min);
+
1371  if(hfill_pos != std::string::npos) {
+
1372  assert(raw_hfill_pos != std::string::npos);
+
1373  if(nb_columns > 0) {
+
1374  const size_t left_len = raw_hfill_pos;
+
1375  const size_t right_len = raw_row.size() - raw_hfill_pos - hfill_tag.size();
+
1376  if(right_len+left_len > nb_columns) {
+
1377  // The right part would go over the terminal width: add a new row.
+
1378  if(right_len < nb_columns) {
+
1379  // There is room for the right part on a new line.
+
1380  const std::string hfill(std::max((size_t)0, nb_columns-right_len), _hfill_char);
+
1381  const std::string hfill_styled = _hfill_fmt(hfill);
+
1382  row = replace(row, "\\{hfill\\}", "\n"+hfill_styled);
+
1383  } else {
+
1384  // Right part still goes over columns: let it go.
+
1385  const std::string hfill(1, _hfill_char);
+
1386  const std::string hfill_styled = _hfill_fmt(hfill);
+
1387  row = replace(row, "\\{hfill\\}", "\n"+hfill_styled);
+
1388  }
+
1389  } else {
+
1390  // There is some space in between left and right parts.
+
1391  const std::string hfill(std::max((size_t)0, nb_columns - (right_len+left_len)), _hfill_char);
+
1392  const std::string hfill_styled = _hfill_fmt(hfill);
+
1393  row = replace(row, "\\{hfill\\}", hfill_styled);
+
1394  }
+
1395  } else {
+
1396  // We don't know the terminal width.
+
1397  const std::string hfill(1, _hfill_char);
+
1398  const std::string hfill_styled = _hfill_fmt(hfill);
+
1399  row = replace(row, "\\{hfill\\}", hfill_styled);
+
1400  }
+
1401  }
+
1402 #else
+
1403  // We cannot know the terminal width.
+
1404  const std::string hfill(1, _hfill_char);
+
1405  const std::string hfill_styled = _hfill_fmt(hfill);
+
1406  row = replace(row, "\\{hfill\\}", hfill_styled);
+
1407 #endif
+
1408  return _level_fmt.at(stage)(row);
+
1409  }
+
1410 
+
1412  void log(
+
1413  const level& stage,
+
1414  const std::string& what,
+
1415  const std::string& file, const std::string& func, const size_t line,
+
1416  const size_t depth_delta = 0
+
1417  ) const
+
1418  {
+
1419  scope_t scope = locate(stage, file, func, line);
+
1420 
+
1421  if(scope.matches) {
+
1422 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1423  *_out << format(_format_log, what, basename(getenv("_")),
+
1424  stage, file, func,
+
1425  line, scope.depth + depth_delta );
+
1426 #else
+
1427  *_out << format(_format_log, what,
+
1428  stage, file, func,
+
1429  line );
+
1430 #endif
+
1431  _out->flush();
+
1432  } // if scopes.matches
+
1433  }
+
1434 
+
1436  template<class In>
+
1437  void dump(
+
1438  const level& stage,
+
1439  const In container_begin, const In container_end,
+
1440  const std::string& file, const std::string& func, const size_t line,
+
1441  const std::string& filename_template = "dump_{n}.dat",
+
1442  const std::string sep = dump_default_sep
+
1443  ) const
+
1444  {
+
1445  scope_t scope = locate(stage, file, func, line);
+
1446 
+
1447  if(scope.matches) {
+
1448  const std::string tag = "\\{n\\}";
+
1449  const std::regex re(tag);
+
1450  std::string outfile = "";
+
1451 
+
1452  // If the file name template has the {n} tag.
+
1453  if(std::regex_search(filename_template, re)) {
+
1454  // Increment n until a free one is found.
+
1455  size_t n = 0;
+
1456  do {
+
1457  outfile = replace(filename_template, tag, n);
+
1458  n++;
+
1459  } while( fs::exists( outfile ) );
+
1460 
+
1461  } else {
+
1462  // Use the parameter as is.
+
1463  outfile = filename_template;
+
1464  }
+
1465 
+
1466  std::ofstream fd(outfile);
+
1467 
+
1468  if(_format_dump.size() > 0) {
+
1469 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1470  fd << format(_format_dump, "", basename(getenv("_")),
+
1471  stage, file, func,
+
1472  line, scope.depth );
+
1473 #else
+
1474  fd << format(_format_dump, "",
+
1475  stage, file, func,
+
1476  line );
+
1477 #endif
+
1478  fd << sep; // sep after comment line.
+
1479  }
+
1480 
+
1481  std::copy(container_begin, container_end,
+
1482  std::ostream_iterator<typename In::value_type>(fd, sep.c_str()));
+
1483 
+
1484  fd.close();
+
1485  } // if scopes.matches
+
1486  }
+
1487 
+
1489 };
+
1490 
+
1493 #else // not WITH_CLUTCHLOG
+
1494 
+
1495 
+
1496 /**********************************************************************
+
1497  * Fake implementation
+
1498  **********************************************************************/
+
1499 
+
1500 // Equivalent class with empty methods, will be optimized out
+
1501 // while allowing to actually have calls implemented without WITH_CLUTCHLOG guards.
+
1502 #pragma GCC diagnostic push
+
1503 #pragma GCC diagnostic ignored "-Wreturn-type"
+
1504 class clutchlog
+
1505 {
+
1506  public:
+
1507  static clutchlog& logger() {}
+
1508  enum level {critical=0, error=1, warning=2, progress=3, note=4, info=5, debug=6, xdebug=7};
+
1509  enum filename {path, base, dir, dirbase, stem, dirstem};
+
1510  class fmt {
+
1511  public:
+
1512  enum class ansi { colors_16, colors_256, colors_16M} mode;
+
1513  enum class typo { reset, bold, underline, inverse, none} style;
+
1514  enum class fg { black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white, none} fore;
+
1515  enum class bg { black, red, green, yellow, blue, magenta, cyan, white, bright_black, bright_red, bright_green, bright_yellow, bright_blue, bright_magenta, bright_cyan, bright_white, none } back;
+
1516  protected:
+
1517  friend std::ostream& operator<<(std::ostream&, const std::tuple<fg,bg,typo>&) {}
+
1518  friend std::ostream& operator<<(std::ostream&, const typo&) {}
+
1519  protected:
+
1520  struct color {
+
1521  ansi mode;
+
1522  enum class ground { fore, back } type;
+
1523  color(ansi a, ground g) : mode(a), type(g) {}
+
1524  virtual bool is_set() const = 0;
+
1525  virtual std::ostream& print_on( std::ostream&) const = 0;
+
1526  friend std::ostream& operator<<(std::ostream&, const color&) {}
+
1527  };
+
1528  struct color_256 : public color {
+
1529  short index;
+
1530  color_256(ground t) : color(ansi::colors_256, t), index(-1) {}
+
1531  color_256(ground t, const short i) : color(ansi::colors_256, t), index(i) {}
+
1532  bool is_set() const {}
+
1533  std::ostream& print_on( std::ostream&) const {}
+
1534  };
+
1535  struct fg_256 : public color_256 {
+
1536  fg_256() : color_256(ground::fore) {}
+
1537  fg_256(const short f) : color_256(ground::fore, f) {}
+
1538  fg_256(const fg&) : color_256(ground::fore, -1) {}
+
1539  } fore_256;
+
1540  struct bg_256 : public color_256 {
+
1541  bg_256() : color_256(ground::back) {}
+
1542  bg_256(const short b) : color_256(ground::back, b) {}
+
1543  bg_256(const bg&) : color_256(ground::back, -1) {}
+
1544  } back_256;
+
1545  struct color_16M : public color {
+
1546  short red, green, blue;
+
1547  color_16M(ground t) : color(ansi::colors_16M, t), red(-1), green(-1), blue(-1) {}
+
1548  color_16M(ground t, short r, short g, short b) : color(ansi::colors_16M, t), red(r), green(g), blue(b) {}
+
1549  color_16M(ground t, const std::string&) : color(ansi::colors_16M, t) {}
+
1550  bool is_set() const {return red > -1 and green > -1 and blue > -1;}
+
1551  std::ostream& print_on( std::ostream&) const {}
+
1552  };
+
1553  struct fg_16M : public color_16M {
+
1554  fg_16M() : color_16M(ground::fore) {}
+
1555  fg_16M(short r, short g, short b) : color_16M(ground::fore, r,g,b) {}
+
1556  fg_16M(const std::string& srgb) : color_16M(ground::fore, srgb) {}
+
1557  fg_16M(const fg&) : color_16M(ground::fore, -1,-1,-1) {}
+
1558  } fore_16M;
+
1559  struct bg_16M : public color_16M {
+
1560  bg_16M() : color_16M(ground::back) {}
+
1561  bg_16M(short r, short g, short b) : color_16M(ground::back, r,g,b) {}
+
1562  bg_16M(const std::string& srgb) : color_16M(ground::back, srgb) {}
+
1563  bg_16M(const bg&) : color_16M(ground::back, -1,-1,-1) {}
+
1564  } back_16M;
+
1565  public:
+
1566  fmt() : mode(ansi::colors_16), style(typo::none), fore(fg::none), back(bg::none) {}
+
1567  fmt( fg f, bg b = bg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1568  fmt( fg f, typo s , bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1569  fmt( bg b, fg f = fg::none, typo s = typo::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1570  fmt( bg b, typo s , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1571  fmt(typo s, fg f = fg::none, bg b = bg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1572  fmt(typo s, bg b , fg f = fg::none) : mode(ansi::colors_16), style(s), fore(f), back(b) {}
+
1573  fmt(fg_256 f, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(b) {}
+
1574  fmt(fg_256 f, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(f), back_256(bg::none) {}
+
1575  fmt(fg, bg_256 b, typo s = typo::none) : mode(ansi::colors_256), style(s), fore_256(fg::none), back_256(b) {}
+
1576  fmt(const short fr, const short fg, const short fb,
+
1577  const short gr, const short gg, const short gb,
+
1578  typo s = typo::none)
+
1579  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(gr,gg,gb) {}
+
1580  fmt(fg,
+
1581  const short gr, const short gg, const short gb,
+
1582  typo s = typo::none)
+
1583  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(gr,gg,gb) {}
+
1584  fmt(const short fr, const short fg, const short fb,
+
1585  bg, typo s = typo::none)
+
1586  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
+
1587  fmt(const short fr, const short fg, const short fb,
+
1588  typo s = typo::none)
+
1589  : mode(ansi::colors_16M), style(s), fore_16M(fr,fg,fb), back_16M(bg::none) {}
+
1590 
+
1591  fmt(const std::string& f, const std::string& b, typo s = typo::none)
+
1592  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(b) {}
+
1593  fmt(fg, const std::string& b, typo s = typo::none)
+
1594  : mode(ansi::colors_16M), style(s), fore_16M(fg::none), back_16M(b) {}
+
1595  fmt(const std::string& f, bg, typo s = typo::none)
+
1596  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
+
1597  fmt(const std::string& f, typo s = typo::none)
+
1598  : mode(ansi::colors_16M), style(s), fore_16M(f), back_16M(bg::none) {}
+
1599  protected:
+
1600  std::ostream& print_on( std::ostream&) const {}
+
1601  public:
+
1602  friend std::ostream& operator<<(std::ostream&, const fmt&) {}
+
1603  std::string operator()( const std::string&) const {}
+
1604  std::string str() const {}
+
1605  static fmt hash( const std::string&, const std::vector<fmt>) {}
+
1606  };
+
1607  public:
+
1608  clutchlog(clutchlog const&) = delete;
+
1609  void operator=(clutchlog const&) = delete;
+
1610  private:
+
1611  clutchlog() {}
+
1612  protected:
+
1613  struct scope_t {};
+
1614  scope_t locate(
+
1615  const level&,
+
1616  const std::string&,
+
1617  const std::string&,
+
1618  const size_t
+
1619  ) const
+
1620  {}
+
1621  public:
+
1622  void format(const std::string&) {}
+
1623  std::string format() const {}
1624 
-
1625 #pragma GCC diagnostic push
-
1626 #pragma GCC diagnostic ignored "-Wunused-parameter"
-
1627  void location(
-
1628  const std::string&,
-
1629  const std::string& in_function=".*",
-
1630  const std::string& in_line=".*"
-
1631  )
-
1632  {}
-
1633 #pragma GCC diagnostic pop
-
1634  template<class ... FMT>
-
1635  void style(level, FMT...) {}
-
1636  void style(level, fmt) {}
-
1637  fmt style(level) const {}
-
1638  public:
-
1639  std::string replace(
-
1640  const std::string&,
-
1641  const std::string&,
-
1642  const std::string&
-
1643  ) const
-
1644  {}
-
1645 
-
1646  std::string replace(
-
1647  const std::string&,
-
1648  const std::string&,
-
1649  const size_t
-
1650  ) const
-
1651  {}
-
1652 
-
1653  std::string format(
-
1654  std::string,
-
1655  const std::string&,
-
1656 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1657  const std::string&,
-
1658 #endif
-
1659  const level&,
-
1660  const std::string&,
-
1661  const std::string&,
-
1662  const size_t
-
1663 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
-
1664  ,
-
1665  const size_t
-
1666 #endif
-
1667  ) const
-
1668  {}
-
1669 
-
1670  void log(
-
1671  const level&,
-
1672  const std::string&,
-
1673  const std::string&, const std::string&, size_t
-
1674  ) const
-
1675  {}
-
1676 
-
1677  template<class In>
-
1678  void dump(
-
1679  const level&,
-
1680  const In, const In,
-
1681  const std::string&, const std::string&, size_t,
-
1682  const std::string&,
-
1683  const std::string
-
1684  ) const
-
1685  {}
-
1686 };
-
1687 #pragma GCC diagnostic pop
-
1688 #endif // WITH_CLUTCHLOG
-
1689 
-
1690 #endif // CLUTCHLOG_H
+
1625  void format_comment(const std::string&) {}
+
1626  std::string format_comment() const {}
+
1627 
+
1628  void out(std::ostream&) {}
+
1629  std::ostream& out() {}
+
1630 
+
1631 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1632  void depth(size_t) {}
+
1633  size_t depth() const {}
+
1634 
+
1635  void depth_mark(const std::string) {}
+
1636  std::string depth_mark() const {}
+
1637  void strip_calls(const size_t) {}
+
1638  size_t strip_calls() const {}
+
1639 #endif
+
1640 #if CLUTCHLOG_HAVE_UNIX_SYSIOCTL == 1
+
1641  void hfill_mark(const char) {}
+
1642  char hfill_mark() const {}
+
1643  void hfill_fmt(fmt) {}
+
1644  fmt hfill_fmt() const {}
+
1645  void hfill_min(const size_t) {}
+
1646  size_t hfill_min() {}
+
1647  void hfill_max(const size_t) {}
+
1648  size_t hfill_max() {}
+
1649 #endif
+
1650  void filehash_styles(std::vector<fmt> ) {}
+
1651  void funchash_styles(std::vector<fmt> ) {}
+
1652  void depth_styles(std::vector<fmt>) {}
+
1653 
+
1654  void threshold(level) {}
+
1655  void threshold(const std::string&) {}
+
1656  level threshold() const {}
+
1657  const std::map<std::string,level> levels() const {}
+
1658  level level_of(const std::string) {}
+
1659 
+
1660  void file(std::string) {}
+
1661  void func(std::string) {}
+
1662  void line(std::string) {}
+
1663 
+
1664 #pragma GCC diagnostic push
+
1665 #pragma GCC diagnostic ignored "-Wunused-parameter"
+
1666  void location(
+
1667  const std::string&,
+
1668  const std::string& in_function=".*",
+
1669  const std::string& in_line=".*"
+
1670  )
+
1671  {}
+
1672 #pragma GCC diagnostic pop
+
1673  template<class ... FMT>
+
1674  void style(level, FMT...) {}
+
1675  void style(level, fmt) {}
+
1676  fmt style(level) const {}
+
1677  void filename(filename) {}
+
1678  public:
+
1679  std::string replace(
+
1680  const std::string&,
+
1681  const std::string&,
+
1682  const std::string&
+
1683  ) const
+
1684  {}
+
1685 
+
1686  std::string replace(
+
1687  const std::string&,
+
1688  const std::string&,
+
1689  const size_t
+
1690  ) const
+
1691  {}
+
1692 
+
1693  std::string format(
+
1694  std::string,
+
1695  const std::string&,
+
1696 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1697  const std::string&,
+
1698 #endif
+
1699  const level&,
+
1700  const std::string&,
+
1701  const std::string&,
+
1702  const size_t
+
1703 #if CLUTCHLOG_HAVE_UNIX_SYSINFO == 1
+
1704  ,
+
1705  const size_t
+
1706 #endif
+
1707  ) const
+
1708  {}
+
1709 
+
1710  void log(
+
1711  const level&,
+
1712  const std::string&,
+
1713  const std::string&, const std::string&, size_t
+
1714  ) const
+
1715  {}
+
1716 
+
1717  template<class In>
+
1718  void dump(
+
1719  const level&,
+
1720  const In, const In,
+
1721  const std::string&, const std::string&, size_t,
+
1722  const std::string&,
+
1723  const std::string
+
1724  ) const
+
1725  {}
+
1726 };
+
1727 #pragma GCC diagnostic pop
+
1728 #endif // WITH_CLUTCHLOG
+
1729 
+
1730 #endif // CLUTCHLOG_H
-
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const std::tuple< fg, bg, typo > &fbs)
Output stream operator for a 3-tuple of 16-colors mode tags.
Definition: clutchlog.h:443
+
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const std::tuple< fg, bg, typo > &fbs)
Output stream operator for a 3-tuple of 16-colors mode tags.
Definition: clutchlog.h:446
clutchlog::default_depth_mark
static std::string default_depth_mark
Default mark for stack depth.
Definition: clutchlog.h:259
-
clutchlog::_format_log
std::string _format_log
Current format of the standard output.
Definition: clutchlog.h:923
-
clutchlog::fmt::color_16M::color_16M
color_16M(ground t, const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:611
-
clutchlog::dump
void dump(const level &stage, const In container_begin, const In container_end, const std::string &file, const std::string &func, const 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.
Definition: clutchlog.h:1399
-
clutchlog::depth_styles
void depth_styles(std::vector< fmt > styles)
Set the styles for value-dependant depth formatting.
Definition: clutchlog.h:1055
-
clutchlog::_level_fmt
std::map< level, fmt > _level_fmt
Dictionary of level identifier to their format.
Definition: clutchlog.h:921
+
clutchlog::_format_log
std::string _format_log
Current format of the standard output.
Definition: clutchlog.h:927
+
clutchlog::fmt::color_16M::color_16M
color_16M(ground t, const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:614
+
clutchlog::dump
void dump(const level &stage, const In container_begin, const In container_end, const std::string &file, const std::string &func, const 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.
Definition: clutchlog.h:1437
+
clutchlog::depth_styles
void depth_styles(std::vector< fmt > styles)
Set the styles for value-dependant depth formatting.
Definition: clutchlog.h:1062
+
clutchlog::_level_fmt
std::map< level, fmt > _level_fmt
Dictionary of level identifier to their format.
Definition: clutchlog.h:925
clutchlog::fmt::back
enum clutchlog::fmt::bg back
Background color.
-
clutchlog::_funchash_fmts
std::vector< fmt > _funchash_fmts
List of candidate format objects for value-dependant function name styling.
Definition: clutchlog.h:956
-
clutchlog::fmt::str
std::string str() const
Return the formatting code as a string.
Definition: clutchlog.h:817
-
clutchlog::fmt::fg_256
Foreground in 256-colors mode.
Definition: clutchlog.h:549
-
clutchlog::line
void line(std::string line)
Set the regular expression filtering the line location.
Definition: clutchlog.h:1085
-
clutchlog::fmt::color::operator<<
friend std::ostream & operator<<(std::ostream &os, const color &c)
Print the actually encoded escaped color sequence on the given stream.
Definition: clutchlog.h:503
-
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const typo &s)
Output stream operator for a typo tag alone, in 16-colors mode.
Definition: clutchlog.h:465
+
clutchlog::_funchash_fmts
std::vector< fmt > _funchash_fmts
List of candidate format objects for value-dependant function name styling.
Definition: clutchlog.h:960
+
clutchlog::fmt::str
std::string str() const
Return the formatting code as a string.
Definition: clutchlog.h:820
+
clutchlog::fmt::fg_256
Foreground in 256-colors mode.
Definition: clutchlog.h:552
+
clutchlog::line
void line(std::string line)
Set the regular expression filtering the line location.
Definition: clutchlog.h:1092
+
clutchlog::fmt::color::operator<<
friend std::ostream & operator<<(std::ostream &os, const color &c)
Print the actually encoded escaped color sequence on the given stream.
Definition: clutchlog.h:506
+
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const typo &s)
Output stream operator for a typo tag alone, in 16-colors mode.
Definition: clutchlog.h:468
clutchlog::dump_default_format
static std::string dump_default_format
Default format of the comment line in file dump.
Definition: clutchlog.h:245
-
clutchlog::out
void out(std::ostream &out)
Set the output stream on which to print.
Definition: clutchlog.h:987
-
clutchlog::fmt::color_16M::is_set
bool is_set() const
Returns true if the underying representation encodes an existing color.
Definition: clutchlog.h:633
-
clutchlog::fmt::fg_16M::fg_16M
fg_16M(const fg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:669
+
clutchlog::_filename
filename _filename
Filename rendering method.
Definition: clutchlog.h:975
+
clutchlog::out
void out(std::ostream &out)
Set the output stream on which to print.
Definition: clutchlog.h:994
+
clutchlog::fmt::color_16M::is_set
bool is_set() const
Returns true if the underying representation encodes an existing color.
Definition: clutchlog.h:636
+
clutchlog::fmt::fg_16M::fg_16M
fg_16M(const fg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:672
clutchlog::dump_default_sep
static std::string dump_default_sep
Default item separator for dump.
Definition: clutchlog.h:252
-
clutchlog::format
std::string format(std::string row, 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 corre...
Definition: clutchlog.h:1269
-
clutchlog::fmt::bg_256
Background in 256-colors mode.
Definition: clutchlog.h:566
+
clutchlog::format
std::string format(std::string row, 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 corre...
Definition: clutchlog.h:1279
+
clutchlog::fmt::bg_256
Background in 256-colors mode.
Definition: clutchlog.h:569
CLUTCHLOG_DEFAULT_DEPTH_MARK
#define CLUTCHLOG_DEFAULT_DEPTH_MARK
Compile-time default mark for stack depth.
Definition: clutchlog.h:256
clutchlog::default_strip_calls
static unsigned int default_strip_calls
Number of call stack levels to remove from depth display by default.
Definition: clutchlog.h:266
clutchlog::default_hfill_min
static size_t default_hfill_min
Default minimum width (number of characters) at which to fill for right-aligning the right part of me...
Definition: clutchlog.h:287
-
clutchlog::replace
std::string replace(const std::string &form, const std::string &mark, const std::string &tag) const
Replace mark by tag in form.
Definition: clutchlog.h:1193
-
clutchlog::fmt::color_256::color_256
color_256(ground t)
Constructor.
Definition: clutchlog.h:528
+
clutchlog::replace
std::string replace(const std::string &form, const std::string &mark, const std::string &tag) const
Replace mark by tag in form.
Definition: clutchlog.h:1203
+
clutchlog::fmt::color_256::color_256
color_256(ground t)
Constructor.
Definition: clutchlog.h:531
clutchlog::fmt::back_16M
clutchlog::fmt::bg_16M back_16M
Current background in 16M-colors mode.
-
clutchlog::fmt::color
Interface class for colors representation.
Definition: clutchlog.h:480
+
clutchlog::fmt::color
Interface class for colors representation.
Definition: clutchlog.h:483
clutchlog::fmt::ansi::colors_16
@ colors_16
16 colors mode.
-
clutchlog::fmt::bg_16M
background in 256-colors mode.
Definition: clutchlog.h:674
+
clutchlog::fmt::bg_16M
background in 256-colors mode.
Definition: clutchlog.h:677
clutchlog::default_hfill_char
static char default_hfill_char
Default character used as a filling for right-align the right part of messages with "{hfill}".
Definition: clutchlog.h:273
-
clutchlog::scope_t::matches
bool matches
Everything is compatible.
Definition: clutchlog.h:1120
+
clutchlog::scope_t::matches
bool matches
Everything is compatible.
Definition: clutchlog.h:1130
clutchlog::fmt::style
enum clutchlog::fmt::typo style
Typographic style.
-
clutchlog::fmt::color_16M
Abstract base class for 16M colors objects (24-bits ANSI).
Definition: clutchlog.h:583
-
clutchlog::fmt::fg_256::fg_256
fg_256(const fg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:561
-
clutchlog::format_comment
void format_comment(const std::string &format)
Set the template string for dumps.
Definition: clutchlog.h:982
-
clutchlog::fmt::bg_16M::bg_16M
bg_16M(const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:694
-
clutchlog::file
void file(std::string file)
Set the regular expression filtering the file location.
Definition: clutchlog.h:1081
-
clutchlog::locate
scope_t 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.
Definition: clutchlog.h:1142
+
clutchlog::fmt::color_16M
Abstract base class for 16M colors objects (24-bits ANSI).
Definition: clutchlog.h:586
+
clutchlog::fmt::fg_256::fg_256
fg_256(const fg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:564
+
clutchlog::format_comment
void format_comment(const std::string &format)
Set the template string for dumps.
Definition: clutchlog.h:989
+
clutchlog::fmt::bg_16M::bg_16M
bg_16M(const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:697
+
clutchlog::file
void file(std::string file)
Set the regular expression filtering the file location.
Definition: clutchlog.h:1088
+
clutchlog::locate
scope_t 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.
Definition: clutchlog.h:1152
clutchlog::fmt::fore_16M
clutchlog::fmt::fg_16M fore_16M
Current foreground in 16M-colors mode.
-
clutchlog::fmt::color_256
Abstract base class for 256 colors objects (8-bits ANSI).
Definition: clutchlog.h:519
-
clutchlog::fmt::fmt
fmt()
Empty constructor, only useful for a no-op formatter.
Definition: clutchlog.h:707
-
clutchlog::style
void style(level stage, fmt style)
Set the style (color and typo) of the given log level, passing a fmt instance.
Definition: clutchlog.h:1106
-
clutchlog::threshold
void threshold(level l)
Set the log level (below which logs are not printed) with an identifier.
Definition: clutchlog.h:1058
-
clutchlog::threshold
level threshold() const
Get the log level below which logs are not printed.
Definition: clutchlog.h:1062
+
clutchlog::fmt::color_256
Abstract base class for 256 colors objects (8-bits ANSI).
Definition: clutchlog.h:522
+
clutchlog::fmt::fmt
fmt()
Empty constructor, only useful for a no-op formatter.
Definition: clutchlog.h:710
+
clutchlog::style
void style(level stage, fmt style)
Set the style (color and typo) of the given log level, passing a fmt instance.
Definition: clutchlog.h:1113
+
clutchlog::threshold
void threshold(level l)
Set the log level (below which logs are not printed) with an identifier.
Definition: clutchlog.h:1065
+
clutchlog::threshold
level threshold() const
Get the log level below which logs are not printed.
Definition: clutchlog.h:1069
clutchlog::fmt::color::is_set
virtual bool is_set() const =0
Should return true if the underying representation encodes an existing color.
-
clutchlog::_level_short
std::map< level, std::string > _level_short
dictionary of level identifier to their 4-letters representation.
Definition: clutchlog.h:919
+
clutchlog::_level_short
std::map< level, std::string > _level_short
dictionary of level identifier to their 4-letters representation.
Definition: clutchlog.h:923
clutchlog::level
level
Available log levels.
Definition: clutchlog.h:313
-
clutchlog::fmt::color_256::color_256
color_256(ground t, const short i)
Constructor.
Definition: clutchlog.h:535
-
clutchlog::fmt::color_256::print_on
std::ostream & print_on(std::ostream &os) const
Print the color index on the given stream.
Definition: clutchlog.h:541
-
clutchlog::fmt::color_16M::color_16M
color_16M(ground t)
Constructor.
Definition: clutchlog.h:592
+
clutchlog::fmt::color_256::color_256
color_256(ground t, const short i)
Constructor.
Definition: clutchlog.h:538
+
clutchlog::fmt::color_256::print_on
std::ostream & print_on(std::ostream &os) const
Print the color index on the given stream.
Definition: clutchlog.h:544
+
clutchlog::fmt::color_16M::color_16M
color_16M(ground t)
Constructor.
Definition: clutchlog.h:595
clutchlog::default_hfill_max
static size_t default_hfill_max
Default maximum width (number of characters) for which to fill for right-aligning the right part of m...
Definition: clutchlog.h:285
-
clutchlog::funchash_styles
void funchash_styles(std::vector< fmt > styles)
Set the candidate styles for value-dependant function name formatting.
Definition: clutchlog.h:1046
-
clutchlog::scope_t::scope_t
scope_t()
Constructor.
Definition: clutchlog.h:1130
-
clutchlog::_in_func
std::regex _in_func
Current function location filter.
Definition: clutchlog.h:949
+
clutchlog::funchash_styles
void funchash_styles(std::vector< fmt > styles)
Set the candidate styles for value-dependant function name formatting.
Definition: clutchlog.h:1053
+
clutchlog::scope_t::scope_t
scope_t()
Constructor.
Definition: clutchlog.h:1140
+
clutchlog::_in_func
std::regex _in_func
Current function location filter.
Definition: clutchlog.h:953
clutchlog::default_format
static std::string default_format
Default format of the messages.
Definition: clutchlog.h:223
-
clutchlog::fmt::bg_16M::bg_16M
bg_16M(short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:686
+
clutchlog::fmt::bg_16M::bg_16M
bg_16M(short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:689
clutchlog::logger
static clutchlog & logger()
Get the logger instance.
Definition: clutchlog.h:306
-
clutchlog::fmt::fg_16M
Foreground in 256-colors mode.
Definition: clutchlog.h:644
+
clutchlog::fmt::fg_16M
Foreground in 256-colors mode.
Definition: clutchlog.h:647
clutchlog::fmt::fore_256
clutchlog::fmt::fg_256 fore_256
Current foreground in 256-colors mode.
clutchlog::fmt::fore
enum clutchlog::fmt::fg fore
Foreground color.
-
clutchlog::filehash_styles
void filehash_styles(std::vector< fmt > styles)
Set the candidate styles for value-dependant file name formatting.
Definition: clutchlog.h:1038
+
clutchlog::filehash_styles
void filehash_styles(std::vector< fmt > styles)
Set the candidate styles for value-dependant file name formatting.
Definition: clutchlog.h:1045
clutchlog::fmt::color::type
enum clutchlog::fmt::color::ground type
Type of color (foreground or background).
-
clutchlog::fmt
Color and style formatter for ANSI terminal escape sequences.
Definition: clutchlog.h:376
-
clutchlog::fmt::color_256::index
short index
The encoded color index in 4-bits ANSI.
Definition: clutchlog.h:523
-
clutchlog::fmt::bg_256::bg_256
bg_256()
Empty constructor: no color.
Definition: clutchlog.h:568
-
clutchlog::func
void func(std::string func)
Set the regular expression filtering the function location.
Definition: clutchlog.h:1083
-
clutchlog::format
std::string format() const
Get the template string.
Definition: clutchlog.h:979
-
clutchlog::_in_file
std::regex _in_file
Current file location filter.
Definition: clutchlog.h:947
-
clutchlog::style
void style(level stage, FMT... styles)
Set the style (color and typo) of the given log level.
Definition: clutchlog.h:1104
-
clutchlog::fmt::bg_256::bg_256
bg_256(const bg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:578
-
clutchlog::fmt::fg_16M::fg_16M
fg_16M()
Empty constructor: no color.
Definition: clutchlog.h:646
-
clutchlog::level_of
level level_of(const std::string name)
Return the log level tag corresponding to the given pre-configured name.
Definition: clutchlog.h:1070
-
clutchlog::_level_word
const std::map< level, std::string > _level_word
Dictionary of level identifier to their string representation.
Definition: clutchlog.h:915
-
clutchlog::fmt::operator()
std::string operator()(const std::string &msg) const
Format the given string with the currently encoded format.
Definition: clutchlog.h:805
-
clutchlog::fmt::color_16M::color_16M
color_16M(ground t, short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:601
-
clutchlog::fmt::color_16M::print_on
std::ostream & print_on(std::ostream &os) const
Print the color RGB triplet on the given stream.
Definition: clutchlog.h:636
-
clutchlog::fmt::bg
bg
Background color codes.
Definition: clutchlog.h:421
+
clutchlog::fmt
Color and style formatter for ANSI terminal escape sequences.
Definition: clutchlog.h:379
+
clutchlog::fmt::color_256::index
short index
The encoded color index in 4-bits ANSI.
Definition: clutchlog.h:526
+
clutchlog::fmt::bg_256::bg_256
bg_256()
Empty constructor: no color.
Definition: clutchlog.h:571
+
clutchlog::func
void func(std::string func)
Set the regular expression filtering the function location.
Definition: clutchlog.h:1090
+
clutchlog::format
std::string format() const
Get the template string.
Definition: clutchlog.h:986
+
clutchlog::_in_file
std::regex _in_file
Current file location filter.
Definition: clutchlog.h:951
+
clutchlog::style
void style(level stage, FMT... styles)
Set the style (color and typo) of the given log level.
Definition: clutchlog.h:1111
+
clutchlog::fmt::bg_256::bg_256
bg_256(const bg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:581
+
clutchlog::fmt::fg_16M::fg_16M
fg_16M()
Empty constructor: no color.
Definition: clutchlog.h:649
+
clutchlog::level_of
level level_of(const std::string name)
Return the log level tag corresponding to the given pre-configured name.
Definition: clutchlog.h:1077
+
clutchlog::filename
void filename(filename f)
Sets the file naming scheme. *‍/.
Definition: clutchlog.h:1118
+
clutchlog::_level_word
const std::map< level, std::string > _level_word
Dictionary of level identifier to their string representation.
Definition: clutchlog.h:919
+
clutchlog::fmt::operator()
std::string operator()(const std::string &msg) const
Format the given string with the currently encoded format.
Definition: clutchlog.h:808
+
clutchlog::fmt::color_16M::color_16M
color_16M(ground t, short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:604
+
clutchlog::fmt::color_16M::print_on
std::ostream & print_on(std::ostream &os) const
Print the color RGB triplet on the given stream.
Definition: clutchlog.h:639
+
clutchlog::fmt::bg
bg
Background color codes.
Definition: clutchlog.h:424
CLUTCHLOG_DEFAULT_FORMAT
#define CLUTCHLOG_DEFAULT_FORMAT
Compile-time default format of the messages (debug mode: with absolute location).
Definition: clutchlog.h:208
-
clutchlog::_in_line
std::regex _in_line
Current line location filter.
Definition: clutchlog.h:951
-
clutchlog::fmt::fg_256::fg_256
fg_256(const short f)
Constructor.
Definition: clutchlog.h:556
+
clutchlog::_in_line
std::regex _in_line
Current line location filter.
Definition: clutchlog.h:955
+
clutchlog::fmt::fg_256::fg_256
fg_256(const short f)
Constructor.
Definition: clutchlog.h:559
clutchlog::fmt::ansi::colors_256
@ colors_256
256 colors mode.
clutchlog::fmt::mode
enum clutchlog::fmt::ansi mode
Current ANSI color mode.
-
clutchlog::replace
std::string 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.
Definition: clutchlog.h:1258
-
clutchlog::format_comment
std::string format_comment() const
Get the template string for dumps.
Definition: clutchlog.h:984
-
clutchlog::fmt::fg_256::fg_256
fg_256()
Empty constructor: no color.
Definition: clutchlog.h:551
+
clutchlog::replace
std::string 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.
Definition: clutchlog.h:1268
+
clutchlog::format_comment
std::string format_comment() const
Get the template string for dumps.
Definition: clutchlog.h:991
+
clutchlog::fmt::fg_256::fg_256
fg_256()
Empty constructor: no color.
Definition: clutchlog.h:554
clutchlog::fmt::ansi::colors_16M
@ colors_16M
16 millions ("true") colors mode.
-
clutchlog::_format_dump
std::string _format_dump
Current format of the file output.
Definition: clutchlog.h:925
+
clutchlog::_format_dump
std::string _format_dump
Current format of the file output.
Definition: clutchlog.h:929
CLUTCHDUMP_DEFAULT_SEP
#define CLUTCHDUMP_DEFAULT_SEP
Compile-time default item separator for dump.
Definition: clutchlog.h:249
-
clutchlog::fmt::bg_256::bg_256
bg_256(const short b)
Constructor.
Definition: clutchlog.h:573
-
clutchlog::fmt::color::ground
ground
Codes for representing foreground or background.
Definition: clutchlog.h:484
-
clutchlog::scope_t
Structure holding a location matching.
Definition: clutchlog.h:1118
+
clutchlog::fmt::bg_256::bg_256
bg_256(const short b)
Constructor.
Definition: clutchlog.h:576
+
clutchlog::fmt::color::ground
ground
Codes for representing foreground or background.
Definition: clutchlog.h:487
+
clutchlog::filename
filename
Available filename rendering methods.
Definition: clutchlog.h:316
+
clutchlog::scope_t
Structure holding a location matching.
Definition: clutchlog.h:1128
CLUTCHLOG_DEFAULT_HFILL_MARK
#define CLUTCHLOG_DEFAULT_HFILL_MARK
Character used as a filling for right-align the right part of messages with "{hfill}".
Definition: clutchlog.h:270
-
clutchlog::fmt::print_on
std::ostream & print_on(std::ostream &os) const
Print the currently encoded format escape code on the given output stream.
Definition: clutchlog.h:756
-
clutchlog::fmt::color_256::is_set
bool is_set() const
Returns true if the underying representation encodes an existing color.
Definition: clutchlog.h:538
-
clutchlog::_out
std::ostream * _out
Standard output.
Definition: clutchlog.h:937
-
clutchlog::out
std::ostream & out()
Get the output stream on which to print.
Definition: clutchlog.h:989
-
clutchlog::threshold
void threshold(const std::string &l)
Set the log level (below which logs are not printed) with a string.
Definition: clutchlog.h:1060
+
clutchlog::fmt::print_on
std::ostream & print_on(std::ostream &os) const
Print the currently encoded format escape code on the given output stream.
Definition: clutchlog.h:759
+
clutchlog::fmt::color_256::is_set
bool is_set() const
Returns true if the underying representation encodes an existing color.
Definition: clutchlog.h:541
+
clutchlog::_out
std::ostream * _out
Standard output.
Definition: clutchlog.h:941
+
clutchlog::out
std::ostream & out()
Get the output stream on which to print.
Definition: clutchlog.h:996
+
clutchlog::threshold
void threshold(const std::string &l)
Set the log level (below which logs are not printed) with a string.
Definition: clutchlog.h:1067
clutchlog::fmt::color::print_on
virtual std::ostream & print_on(std::ostream &os) const =0
Should print the underlying representation on the given stream.
-
clutchlog::levels
const std::map< std::string, level > & levels() const
Get the map of available log levels string representations toward their identifier....
Definition: clutchlog.h:1064
-
clutchlog::_strip_calls
size_t _strip_calls
Current number of call stack levels to remove from depth display.
Definition: clutchlog.h:913
-
clutchlog::scope_t::stage
level stage
Current log level.
Definition: clutchlog.h:1122
-
clutchlog::scope_t::there
bool there
Location is compatible.
Definition: clutchlog.h:1128
-
clutchlog::fmt::fg_16M::fg_16M
fg_16M(const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:664
+
clutchlog::levels
const std::map< std::string, level > & levels() const
Get the map of available log levels string representations toward their identifier....
Definition: clutchlog.h:1071
+
clutchlog::_strip_calls
size_t _strip_calls
Current number of call stack levels to remove from depth display.
Definition: clutchlog.h:917
+
clutchlog::scope_t::stage
level stage
Current log level.
Definition: clutchlog.h:1132
+
clutchlog::scope_t::there
bool there
Location is compatible.
Definition: clutchlog.h:1138
+
clutchlog::fmt::fg_16M::fg_16M
fg_16M(const std::string &srgb)
Hex triplet string constructor.
Definition: clutchlog.h:667
CLUTCHLOG_STRIP_CALLS
#define CLUTCHLOG_STRIP_CALLS
Compile-time number of call stack levels to remove from depth display by default.
Definition: clutchlog.h:263
-
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const fmt &fmt)
Output stream overload.
Definition: clutchlog.h:790
-
clutchlog::log
void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) const
Print a log message IF the location matches the given one.
Definition: clutchlog.h:1374
-
clutchlog::fmt::bg_16M::bg_16M
bg_16M(const bg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:699
-
clutchlog::fmt::bg_16M::bg_16M
bg_16M()
Empty constructor: no color.
Definition: clutchlog.h:676
-
clutchlog::_word_level
std::map< std::string, level > _word_level
Dictionary of level string to their identifier.
Definition: clutchlog.h:917
-
clutchlog::_stage
level _stage
Current log level.
Definition: clutchlog.h:945
-
clutchlog::style
fmt style(level stage) const
Get the configured fmt instance of the given log level.
Definition: clutchlog.h:1108
-
clutchlog::fmt::typo
typo
Typographic style codes.
Definition: clutchlog.h:389
-
clutchlog::location
void location(const std::string &in_file, const std::string &in_function=".*", const std::string &in_line=".*")
Set the regular expressions filtering the location.
Definition: clutchlog.h:1088
+
clutchlog::fmt::operator<<
friend std::ostream & operator<<(std::ostream &os, const fmt &fmt)
Output stream overload.
Definition: clutchlog.h:793
+
clutchlog::log
void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, const size_t line, const size_t depth_delta=0) const
Print a log message IF the location matches the given one.
Definition: clutchlog.h:1412
+
clutchlog::fmt::bg_16M::bg_16M
bg_16M(const bg &)
Conversion constructor from 16-colors mode.
Definition: clutchlog.h:702
+
clutchlog::fmt::bg_16M::bg_16M
bg_16M()
Empty constructor: no color.
Definition: clutchlog.h:679
+
clutchlog::_word_level
std::map< std::string, level > _word_level
Dictionary of level string to their identifier.
Definition: clutchlog.h:921
+
clutchlog::_stage
level _stage
Current log level.
Definition: clutchlog.h:949
+
clutchlog::style
fmt style(level stage) const
Get the configured fmt instance of the given log level.
Definition: clutchlog.h:1115
+
clutchlog::fmt::typo
typo
Typographic style codes.
Definition: clutchlog.h:392
+
clutchlog::location
void location(const std::string &in_file, const std::string &in_function=".*", const std::string &in_line=".*")
Set the regular expressions filtering the location.
Definition: clutchlog.h:1095
CLUTCHLOG_HAVE_UNIX_SYSINFO
#define CLUTCHLOG_HAVE_UNIX_SYSINFO
True if POSIX headers necessary for stack depth management are available.
Definition: clutchlog.h:33
-
clutchlog::_filehash_fmts
std::vector< fmt > _filehash_fmts
List of candidate format objects for value-dependant file name styling.
Definition: clutchlog.h:954
+
clutchlog::_filehash_fmts
std::vector< fmt > _filehash_fmts
List of candidate format objects for value-dependant file name styling.
Definition: clutchlog.h:958
clutchlog
The single class which holds everything.
Definition: clutchlog.h:187
-
clutchlog::fmt::ansi
ansi
ANSI code configuring the available number of colors.
Definition: clutchlog.h:379
-
clutchlog::fmt::fg_16M::fg_16M
fg_16M(short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:656
-
clutchlog::fmt::fg
fg
Foreground color codes.
Definition: clutchlog.h:400
-
clutchlog::fmt::color_16M::red
short red
The encoded RGB indices.
Definition: clutchlog.h:587
+
clutchlog::fmt::ansi
ansi
ANSI code configuring the available number of colors.
Definition: clutchlog.h:382
+
clutchlog::fmt::fg_16M::fg_16M
fg_16M(short r, short g, short b)
Numeric triplet constructor.
Definition: clutchlog.h:659
+
clutchlog::fmt::fg
fg
Foreground color codes.
Definition: clutchlog.h:403
+
clutchlog::fmt::color_16M::red
short red
The encoded RGB indices.
Definition: clutchlog.h:590
CLUTCHDUMP_DEFAULT_FORMAT
#define CLUTCHDUMP_DEFAULT_FORMAT
Compile-time default format of the comment line in file dump.
Definition: clutchlog.h:231
-
clutchlog::fmt::color::color
color(ansi a, ground g)
Constructor.
Definition: clutchlog.h:494
+
clutchlog::fmt::color::color
color(ansi a, ground g)
Constructor.
Definition: clutchlog.h:497
clutchlog::fmt::back_256
clutchlog::fmt::bg_256 back_256
Current background in 256-colors mode.
@@ -84,7 +84,7 @@ $(document).ready(function(){initNavTree('dir_59425e443f801f1f2fd8bbe4959a3ccf.h
-

tests → clutchlog Relation

Public Member Functions

std::cout << error("ERROR") << std::endl;
Note
A formatter called this way WILL output a reset escape code at the end.
-

Definition at line 805 of file clutchlog.h.

+

Definition at line 808 of file clutchlog.h.

-

References print_on().

+

References print_on().

@@ -462,7 +462,7 @@ std::ostream & 
std::cout << error << "ERROR" << end << std::endl;
Note
An formatter called this way will NOT output a reset escape code.
-

Definition at line 790 of file clutchlog.h.

+

Definition at line 793 of file clutchlog.h.

@@ -497,7 +497,7 @@ std::ostream & 
Definition at line 379 of file clutchlog.h.

+

Definition at line 382 of file clutchlog.h.

@@ -506,7 +506,7 @@ std::ostream & 
Color and style formatter for ANSI terminal escape sequences.
Definition: clutchlog.h:376
+
Color and style formatter for ANSI terminal escape sequences.
Definition: clutchlog.h:379
clutchlog -  0.15 +  0.16
clutchlog -  0.15 +  0.16
clutchlog -  0.15 +  0.16
clutchlog -  0.15 +  0.16
File in testsIncludes file in clutchlog
t-assert.cppclutchlog.h
t-color.cppclutchlog.h
t-color16M.cppclutchlog.h
t-color256.cppclutchlog.h
t-demo-extravagant.cppclutchlog.h
t-demo.cppclutchlog.h
t-depth-delta.cppclutchlog.h
t-dump.cppclutchlog.h
t-fmt-constructors.cppclutchlog.h
t-hash-color.cppclutchlog.h
t-log.cppclutchlog.h
t-one-line-if.cppclutchlog.h
+

tests → clutchlog Relation

File in testsIncludes file in clutchlog
t-assert.cppclutchlog.h
t-color.cppclutchlog.h
t-color16M.cppclutchlog.h
t-color256.cppclutchlog.h
t-demo-extravagant.cppclutchlog.h
t-demo.cppclutchlog.h
t-depth-delta.cppclutchlog.h
t-dump.cppclutchlog.h
t-filename.cppclutchlog.h
t-fmt-constructors.cppclutchlog.h
t-hash-color.cppclutchlog.h
t-log.cppclutchlog.h
t-one-line-if.cppclutchlog.h
diff --git a/docs/files_dup.js b/docs/files_dup.js index de394c4..e4d1828 100644 --- a/docs/files_dup.js +++ b/docs/files_dup.js @@ -9,6 +9,7 @@ var files_dup = [ "t-demo.cpp", "t-demo_8cpp_source.html", null ], [ "t-depth-delta.cpp", "t-depth-delta_8cpp_source.html", null ], [ "t-dump.cpp", "t-dump_8cpp_source.html", null ], + [ "t-filename.cpp", "t-filename_8cpp_source.html", null ], [ "t-fmt-constructors.cpp", "t-fmt-constructors_8cpp_source.html", null ], [ "t-hash-color.cpp", "t-hash-color_8cpp_source.html", null ], [ "t-log.cpp", "t-log_8cpp_source.html", null ], diff --git a/docs/functions.html b/docs/functions.html index 7ae6bc1..31320a1 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -28,7 +28,7 @@ Logo
clutchlog -  0.15 +  0.16
@@ -90,6 +90,9 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  • _filehash_fmts : clutchlog
  • +
  • _filename +: clutchlog +
  • _format_dump : clutchlog
  • @@ -224,6 +227,9 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
  • filehash_styles() : clutchlog
  • +
  • filename +: clutchlog +
  • fmt() : clutchlog::fmt
  • @@ -237,10 +243,10 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable(); : clutchlog::fmt
  • format() -: clutchlog +: clutchlog
  • format_comment() -: clutchlog +: clutchlog
  • func() : clutchlog diff --git a/docs/functions_enum.html b/docs/functions_enum.html index 3dccd46..f965338 100644 --- a/docs/functions_enum.html +++ b/docs/functions_enum.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    @@ -94,6 +94,9 @@ $(document).ready(function(){initNavTree('functions_enum.html',''); initResizabl
  • fg : clutchlog::fmt
  • +
  • filename +: clutchlog +
  • ground : clutchlog::fmt::color
  • diff --git a/docs/functions_func.html b/docs/functions_func.html index eab349f..64f0a99 100644 --- a/docs/functions_func.html +++ b/docs/functions_func.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    @@ -132,11 +132,14 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
  • filehash_styles() : clutchlog
  • +
  • filename() +: clutchlog +
  • fmt() : clutchlog::fmt
  • format() -: clutchlog +: clutchlog
  • format_comment() : clutchlog diff --git a/docs/functions_rela.html b/docs/functions_rela.html index c2eefc2..035e264 100644 --- a/docs/functions_rela.html +++ b/docs/functions_rela.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/functions_vars.html b/docs/functions_vars.html index d4a0507..5f74176 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    @@ -90,6 +90,9 @@ $(document).ready(function(){initNavTree('functions_vars.html',''); initResizabl
  • _filehash_fmts : clutchlog
  • +
  • _filename +: clutchlog +
  • _format_dump : clutchlog
  • diff --git a/docs/globals.html b/docs/globals.html index 918f052..7584db1 100644 --- a/docs/globals.html +++ b/docs/globals.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/globals_defs.html b/docs/globals_defs.html index a0cb07e..01b28ff 100644 --- a/docs/globals_defs.html +++ b/docs/globals_defs.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/graph_legend.html b/docs/graph_legend.html index edb553d..003b89f 100644 --- a/docs/graph_legend.html +++ b/docs/graph_legend.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group___default_config.html b/docs/group___default_config.html index fe42a2a..a06d5bb 100644 --- a/docs/group___default_config.html +++ b/docs/group___default_config.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group___formating.html b/docs/group___formating.html index 5bbe894..2a6ff4e 100644 --- a/docs/group___formating.html +++ b/docs/group___formating.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group___main.html b/docs/group___main.html index 80a0c24..1ae3900 100644 --- a/docs/group___main.html +++ b/docs/group___main.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group___main.js b/docs/group___main.js index c1d2ac0..5fc80f3 100644 --- a/docs/group___main.js +++ b/docs/group___main.js @@ -1,11 +1,11 @@ var group___main = [ [ "clutchlog", "classclutchlog.html", [ - [ "System-dependent stack depth", "index.html#autotoc_md26", null ], - [ "System-dependent horizontal fill", "index.html#autotoc_md27", null ], - [ "Dependencies", "index.html#autotoc_md28", null ], - [ "Variable names within the CLUTCHLOG macro", "index.html#autotoc_md29", null ], - [ "Features", "index.html#autotoc_md30", null ], + [ "System-dependent stack depth", "index.html#autotoc_md27", null ], + [ "System-dependent horizontal fill", "index.html#autotoc_md28", null ], + [ "Dependencies", "index.html#autotoc_md29", null ], + [ "Variable names within the CLUTCHLOG macro", "index.html#autotoc_md30", null ], + [ "Features", "index.html#autotoc_md31", null ], [ "scope_t", "structclutchlog_1_1scope__t.html", [ [ "scope_t", "structclutchlog_1_1scope__t.html#a0f1d865ffcf17f215e5559cdd2690572", null ], [ "matches", "structclutchlog_1_1scope__t.html#ae6c0e4ed20db797124ed1e5faa033ad9", null ], @@ -37,6 +37,7 @@ var group___main = [ "style", "classclutchlog.html#ac3ec55057b9c734b66f169bf43dbd591", null ], [ "style", "classclutchlog.html#ad1cfa9945c3f7f98fe8ce724c627d0d6", null ], [ "style", "classclutchlog.html#a4831f44fd5ade102e57320632095934d", null ], + [ "filename", "classclutchlog.html#a82b9375728af2d962831a743d95f4ae7", null ], [ "locate", "classclutchlog.html#a4ebdfcded6c56262676bf6926d63fc96", null ], [ "replace", "classclutchlog.html#a972f895c70edc335f3018a2c8971d59e", null ], [ "replace", "classclutchlog.html#ae90d5a1a428587ad67b38b2ea4ca9fa2", null ], @@ -65,6 +66,7 @@ var group___main = [ "_in_line", "classclutchlog.html#a41757198b29862832a14472a9e5e24c6", null ], [ "_filehash_fmts", "classclutchlog.html#a2a334e009533744b52f01ef240a59e9d", null ], [ "_funchash_fmts", "classclutchlog.html#a095e1545a2085ac623e4af19364fea7f", null ], + [ "_filename", "classclutchlog.html#a0431616914dbbecb908a794f5b46dada", null ], [ "level", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928", [ [ "critical", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928af332f31a368c931f79b9b64d55fc7701", null ], [ "error", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928a023c3e8a55ddfd140d3e3268dd6221e9", null ], @@ -74,6 +76,14 @@ var group___main = [ "info", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928aa1ea607f2bfe5db06f1cf2bd991f7dc1", null ], [ "debug", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928a911f5ef324f37061f68a239577e0d0bd", null ], [ "xdebug", "classclutchlog.html#a10fd25a1b51c8c95bd6d876ce1b4b928abba74b810831c7753777e6dcc0c0f4e2", null ] + ] ], + [ "filename", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20e", [ + [ "path", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ea19ebb39c0f117afbe6658bbc9bea68a4", null ], + [ "base", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ead79ddc78294d362c22ba917cba2cd3ef", null ], + [ "dir", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ea35cf5f272267d9656cfcfe52243f4841", null ], + [ "dirbase", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ea9534ecbf6a632833ca32ea5bb33f7eea", null ], + [ "stem", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ea04548b133168127416623d51dd3b9338", null ], + [ "dirstem", "classclutchlog.html#a822062ffa857bd16ff488f9c749ff20ea5b96778dd84a50c1b288b31a5200df4d", null ] ] ] ] ] ]; \ No newline at end of file diff --git a/docs/group___use_macros.html b/docs/group___use_macros.html index dfca8d2..9b21266 100644 --- a/docs/group___use_macros.html +++ b/docs/group___use_macros.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group__colors16.html b/docs/group__colors16.html index c5291b3..0dcd958 100644 --- a/docs/group__colors16.html +++ b/docs/group__colors16.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/group__colors256__16_m.html b/docs/group__colors256__16_m.html index ce01f78..8f5793f 100644 --- a/docs/group__colors256__16_m.html +++ b/docs/group__colors256__16_m.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/hierarchy.html b/docs/hierarchy.html index 9399f28..a9d01bd 100644 --- a/docs/hierarchy.html +++ b/docs/hierarchy.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    diff --git a/docs/index.html b/docs/index.html index 4c937e3..5f42249 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,7 +28,7 @@ Logo
    clutchlog -  0.15 +  0.16
    @@ -109,25 +109,26 @@ $(document).ready(function(){initNavTree('index.html',''); initResizable(); });
  • Stack Depth Mark
  • Horizontal Filling
  • Stack Depth
  • +
  • Filename
  • -
  • Disabled calls
  • -
  • Low-level API
  • -
  • (De)clutch any function call
  • -
  • (De)clutch any code section
  • -
  • Manually Increase Stack Depth
  • +
  • Disabled calls
  • +
  • Low-level API
  • +
  • (De)clutch any function call
  • +
  • (De)clutch any code section
  • +
  • Manually Increase Stack Depth
  • -
  • Examples
  • -
  • Limitations