diff --git a/build_all.sh b/build_all.sh index 500fcd2..12aa9f1 100755 --- a/build_all.sh +++ b/build_all.sh @@ -25,6 +25,7 @@ done echo "Update documentation" cd Debug_ON +cmake -DBUILD_DOCUMENTATION=ON .. make doc cp -r html/* ../docs/ diff --git a/docs/classclutchlog-members.html b/docs/classclutchlog-members.html index d1efec5..3d671bb 100644 --- a/docs/classclutchlog-members.html +++ b/docs/classclutchlog-members.html @@ -93,24 +93,25 @@ $(function() {
mark by tag in form. More...| File in tests | Includes file in clutchlog |
|---|---|
| t-color.cpp | clutchlog.h |
| t-demo.cpp | clutchlog.h |
| t-dump.cpp | clutchlog.h |
| t-log.cpp | clutchlog.h |
| File in tests | Includes file in clutchlog |
|---|---|
| t-assert.cpp | clutchlog.h |
| t-color.cpp | clutchlog.h |
| t-demo.cpp | clutchlog.h |
| t-dump.cpp | clutchlog.h |
| t-log.cpp | clutchlog.h |
Dump the given container.
+| #define CLUTCHFUNC | +( | ++ | LEVEL, | +
| + | + | + | FUNC, | +
| + | + | + | ... | +
| + | ) | ++ |
Call an assert at the given level.
+Log a message at the given level.
diff --git a/docs/index.html b/docs/index.html index 1d3c436..c699516 100644 --- a/docs/index.html +++ b/docs/index.html @@ -73,23 +73,31 @@ $(function() {Clutchlog is a logging system which targets versatile debugging. It allows to (de)clutch messages for a given: log level, source code location or call stack depth.
+Clutchlog is a logging system which targets versatile debugging. It allows to (de)clutch messages for a given: log level, source code location or call stack depth.
Clutchlog allows to select which log messages will be displayed, based on their locations:
Additionally, Clutchlog will do its best to allow the compiler to optimize out calls, for instance debug messages in "Release" builds.
+Additional features:
+Adding a message is a simple as calling a macro (which is declutched in Debug build type, when NDEBUG is not defined):
To configure the display, you indicate the three types of locations, for example in your main function:
For more detailled examples, see the "API documentation" section below and the tests directory.
The default log format is "[{name}] {level_letter}:{depth_marks} {msg}\t\t\t\t\t{func} @ {file}:{line}\n", it can be overriden at compile time by defining the CLUTCHLOG_DEFAULT_FORMAT macro.
The default format of the comment added with the dump macro is "# [{name}] {level} in {func} (at depth {depth}) @ {file}:{line}". It can be edited with the format_comment method. If it is set to an empty string, then no comment line is added. The default can be modified at compile time with CLUTCHDUMP_DEFAULT_FORMAT. By default, the separator between items in the container is a new line. To change this behaviour, you can change CLUTCHDUMP_DEFAULT_SEP or call the low-level dump method.
The mark used with the {depth_marks} tag can be configured with the depth_mark method, and its default with the CLUTCHLOG_DEFAULT_DEPTH_MARK macro:
The mark used with the {depth_marks} tag can be configured with the depth_mark method, and its default with the CLUTCHLOG_DEFAULT_DEPTH_MARK macro:
The output can be colored differently depending on the log level.
Or, if you want to declare some semantics beforehand:
Using the clutchlog::fmt class, you can style:
This behavior intend to remove as many conditional statements as possible when not debugging, without having to use preprocessor guards around calls to clutchlog, thus saving run time at no readability cost.
All configuration setters have a getters counterpart, with the same name but taking no parameter, for example:
To control more precisely the logging, one can use the low-level log method:
A helper macro can helps to fill in the location with the actual one, as seen by the compiler:
A similar dump method exists:
All configuration setters have a getters counterpart, with the same name but taking no parameter, for example:
To control more precisely the logging, one can use the low-level log method:
A helper macro can helps to fill in the location with the actual one, as seen by the compiler:
A similar dump method exists:
The CLUTHFUNC macro allows to wrap any function within the current logger.
For instance, this can be useful if you want to (de)clutch calls to asserts. To do that, just declare your own macro:
Thus, any call like ASSERT(error, x > 3); will be declutchable with the same configuration than a call to CLUTCHLOG.
Log levels use a classical semantics for a human skilled in the art, in decreasing order of importance:
Note: the log levels constants are lower case (for example: clutchlog::level::xdebug), but their string representation is not (e.g. "XDebug", this should be taken into account when using level_of).
Because the call stack depth and program name access are system-dependent, the features relying on the depth of the call stack and the display of the program name are only available for operating systems having the following headers: execinfo.h, stdlib.h and libgen.h (so far, tested with Linux).
Some colors/styles may not be supported by some exotic terminal emulators.
-Clutchlog needs C++-17 with the filesystem feature. You may need to indicate -std=c++17 -lstdc++fs to your compiler.
Clutchlog needs C++-17 with the filesystem feature. You may need to indicate -std=c++17 -lstdc++fs to some compilers.
What Clutchlog do not provide at the moment (but may in a near future):
+What Clutchlog will most certainly never provide:
+To use clutchlog, just include its header in your code and either ensure that the NDEBUG preprocessor variable is not set, either define the WITH_CLUTCHLOG preprocessor variable.
If you're using CMake (or another modern build system), it will unset NDEBUG —and thus enable clutchlog— only for the "Debug" build type, which is usually what you want if you use clutchlog, anyway.