forked from motis-project/utl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
84 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# MOTIS utl module documentation | ||
MOTIS is an open-source software platform for efficient planning and routing in multi-modal transportation systems. | ||
GitHub main repository: https://github.com/motis-project/motis | ||
|
||
This is the documentation for the **utl** (utility) module. | ||
|
||
:::{toctree} | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
::: | ||
|
||
## Logging | ||
The simplest way to produce log lines is to use the `utl:log()` function, | ||
or the wrapping functions for the various log levels, | ||
`utl::debug()`, `utl::info()` and `utl::error()`: | ||
```c++ | ||
#include "utl/logging.h" | ||
|
||
utl::info("MyCtx", "Simple message"); | ||
``` | ||
|
||
The first parameter is the **context**, that provides an information of the origin of the log line inside MOTIS code. | ||
|
||
The following log levels are supported: | ||
|
||
debug | ||
: Messages that contain information only useful when debugging MOTIS | ||
|
||
info | ||
: Important information about a normal behavior of the program | ||
|
||
error | ||
: Details on an abnormal behavior of the application | ||
|
||
### Advanced usage | ||
You can insert variables in the message by using `{}` and passing them as extra arguments | ||
(formatting is performed by the [fmt](https://fmt.dev>) library): | ||
```c++ | ||
utl::info("MyCtx", "String={} Int={}", "Hello", 42); | ||
``` | ||
|
||
You can specify **metadata** using `.attrs()`: | ||
```c++ | ||
utl::info("MyCtx", "Message").attrs({{"key1", "value1"}, {"key2", "value2"}}); | ||
``` | ||
|
||
### API details | ||
:::{doxygenfunction} utl::log | ||
::: | ||
|
||
:::{note} | ||
Those logging function are an exception to the rule that, in MOTIS, | ||
we use [Aggregate Initialization](https://en.cppreference.com/w/cpp/language/aggregate_initialization) wherever possible, | ||
but here we do not want to use `utl::info{...}`. | ||
::: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.