From c871336f6d195a805056786edf641746aea62ba4 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 19 Dec 2021 08:38:13 +0100 Subject: [PATCH] feat: add the CLUTCHLOG_STRIP_CALLS macro To configure the default number of levels removed from the calls stack depth computations. --- README.md | 4 + clutchlog/clutchlog.h | 6 +- docs/classclutchlog.html | 4 +- docs/classclutchlog_1_1fmt.html | 2 +- docs/clutchlog_8h.html | 7 +- docs/clutchlog_8h_source.html | 1507 +++++++++++++------------- docs/globals.html | 6 + docs/globals_defs.html | 6 + docs/group__DefaultConfigMacros.html | 4 + docs/group__UseMacros.html | 6 +- docs/index.html | 20 +- docs/search/all_1.js | 3 +- docs/search/all_2.js | 4 +- docs/search/all_3.js | 14 +- docs/search/all_4.js | 2 +- docs/search/all_5.js | 14 +- docs/search/all_6.js | 2 +- docs/search/all_7.js | 6 +- docs/search/all_8.js | 2 +- docs/search/all_9.js | 2 +- docs/search/all_a.js | 4 +- docs/search/all_b.js | 4 +- docs/search/all_c.html | 8 +- docs/search/all_c.js | 3 +- docs/search/classes_0.js | 2 +- docs/search/classes_1.js | 2 +- docs/search/classes_2.js | 2 +- docs/search/enums_0.js | 2 +- docs/search/enums_1.js | 2 +- docs/search/enums_2.js | 2 +- docs/search/enums_3.js | 2 +- docs/search/files_0.js | 2 +- docs/search/functions_0.js | 2 +- docs/search/functions_1.js | 10 +- docs/search/functions_2.js | 12 +- docs/search/functions_3.js | 4 +- docs/search/functions_4.js | 2 +- docs/search/functions_5.js | 2 +- docs/search/functions_6.js | 2 +- docs/search/functions_7.js | 2 +- docs/search/groups_0.js | 2 +- docs/search/groups_1.js | 2 +- docs/search/groups_2.js | 2 +- docs/search/groups_3.js | 2 +- docs/search/related_0.js | 2 +- docs/search/searchdata.js | 11 +- 46 files changed, 880 insertions(+), 833 deletions(-) diff --git a/README.md b/README.md index c9893f5..e9d0d3c 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,10 @@ and its default with the `CLUTCHLOG_DEFAULT_DEPTH_MARK` macro: log.depth_mark(CLUTCHLOG_DEFAULT_DEPTH_MARK); // Defaults to ">". ``` +By default, clutchlog removes 5 levels of the calls stack, so that your `main` +entrypoint corresponds to a depth of zero. +You can change this behaviour by defining the `CLUTCHLOG_STRIP_CALLS` macro. + Output style ------------ diff --git a/clutchlog/clutchlog.h b/clutchlog/clutchlog.h index 9a2fd9e..8120717 100644 --- a/clutchlog/clutchlog.h +++ b/clutchlog/clutchlog.h @@ -83,6 +83,10 @@ namespace fs = std::filesystem; #define CLUTCHLOG_DEFAULT_DEPTH_BUILT_NODEBUG clutchlog::level::progress #endif // CLUTCHLOG_DEFAULT_DEPTH_BUILT +#ifndef CLUTCHLOG_STRIP_CALLS +//! Number of call stack levels to remove from depth display by default. +#define CLUTCHLOG_STRIP_CALLS 5 +#endif // CLUTCHLOG_STRIP_CALLS /** @} */ /** @addtogroup UseMacros High-level API macros @@ -343,7 +347,7 @@ class clutchlog private: clutchlog() : // system, main, log - _strip_calls(5), + _strip_calls(CLUTCHLOG_STRIP_CALLS), _level_word({ {level::critical,"Critical"}, {level::error ,"Error"}, diff --git a/docs/classclutchlog.html b/docs/classclutchlog.html index 9893573..29852e8 100644 --- a/docs/classclutchlog.html +++ b/docs/classclutchlog.html @@ -385,8 +385,8 @@ template<class ... FMT>
  • clutchlog/clutchlog.h
  • -
    void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, size_t line) const
    Print a log message IF the location matches the given one.
    Definition: clutchlog.h:678
    -
    static clutchlog & logger()
    Get the logger instance.
    Definition: clutchlog.h:202
    +
    void log(const level &stage, const std::string &what, const std::string &file, const std::string &func, size_t line) const
    Print a log message IF the location matches the given one.
    Definition: clutchlog.h:684
    +
    static clutchlog & logger()
    Get the logger instance.
    Definition: clutchlog.h:208