From f26c39d2b09529f140573bd32488a59083adb7f9 Mon Sep 17 00:00:00 2001 From: Lucas-C Date: Fri, 17 Jan 2025 10:32:10 +0000 Subject: [PATCH] deploy: 737eec02fdc0c57439017254dd7379f216200048 --- _sources/index.md.txt | 55 +++++++++++++++++++++++++++++++++++++++++ _sources/index.rst.txt | 51 -------------------------------------- genindex.html | 9 ------- index.html | 49 ++++++++++++++++++++---------------- objects.inv | Bin 424 -> 253 bytes searchindex.js | 2 +- 6 files changed, 84 insertions(+), 82 deletions(-) create mode 100644 _sources/index.md.txt delete mode 100644 _sources/index.rst.txt diff --git a/_sources/index.md.txt b/_sources/index.md.txt new file mode 100644 index 0000000..f3d9c2a --- /dev/null +++ b/_sources/index.md.txt @@ -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{...}`. +::: diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt deleted file mode 100644 index 002c78f..0000000 --- a/_sources/index.rst.txt +++ /dev/null @@ -1,51 +0,0 @@ -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. - -.. - Table of contents - ----------------- - - .. toctree:: - :maxdepth: 2 - :caption: Contents: - -Logging -------- - -The simplest way to produce log lines is to use the ``logF()`` macro:: - - logF(info, "Simple message"); - -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 -^^^^^^^^^^^^^^ - -By default, ``logF()`` inserts the current filename & line number in the log line. -However, you can use ``log()`` to specify your own **context** :: - - log(info, "http.get.resource", "Details"); - -You can also insert variables in the message by using ``{}`` and passing them as extra arguments:: - - logF(info, "String={} Int={}", "Hello", 42); - -API details -^^^^^^^^^^^ -Under the hood, the ``log()`` & ``logF()`` macros use the ``utl::log()`` function: - -.. doxygenfunction:: utl::log diff --git a/genindex.html b/genindex.html index 9b1fe26..a23fc5c 100644 --- a/genindex.html +++ b/genindex.html @@ -69,17 +69,8 @@

Index

- U
-

U

- - -
- diff --git a/index.html b/index.html index c72fb60..c3ab4d1 100644 --- a/index.html +++ b/index.html @@ -46,10 +46,7 @@
  • MOTIS utl module documentation @@ -72,7 +69,7 @@
  • - View page source + View page source

  • @@ -83,16 +80,23 @@

    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

    +GitHub main repository: https://github.com/motis-project/motis

    This is the documentation for the utl (utility) module.

    +
    +

    Logging

    -

    The simplest way to produce log lines is to use the logF() macro:

    -
    logF(info, "Simple message");
    +

    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():

    +
    #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

    @@ -102,25 +106,28 @@

    Logging

    Advanced usage

    -

    By default, logF() inserts the current filename & line number in the log line. -However, you can use log() to specify your own context

    -
    log(info, "http.get.resource", "Details");
    +

    You can insert variables in the message by using {} and passing them as extra arguments +(formatting is performed by the fmt library):

    +
    utl::info("MyCtx", "String={} Int={}", "Hello", 42);
     
    -

    You can also insert variables in the message by using {} and passing them as extra arguments:

    -
    logF(info, "String={} Int={}", "Hello", 42);
    +

    You can specify metadata using .attrs():

    +
    utl::info("MyCtx", "Message").attrs({{"key1", "value1"}, {"key2", "value2"}});
     

    API details

    -

    Under the hood, the log() & logF() macros use the utl::log() function:

    -
    -
    -template<typename ...Args>
    void utl::log(log_level const level, char const *ctx, fmt::format_string<Args...> fmt_str, Args&&... args)
    -

    Produce a new log line at the given level, with the given prefix ctx and message

    -
    - +
    +

    Warning

    +

    doxygenfunction: Cannot find function “utl::log” in doxygen xml output for project “utl” from directory: ./xml/

    +
    +
    +

    Note

    +

    Those logging function are an exception to the rule that, in MOTIS, +we use Aggregate Initialization wherever possible, +but here we do not want to use utl::info{...}.

    +
    diff --git a/objects.inv b/objects.inv index 6fd7b47fb3ee52845a88faf4dc36c42439223614..38f16da46383e4f0846f7f95793db0724901b79f 100644 GIT binary patch delta 134 zcmV;10D1qY1N{Mzet%0(&CAS7Nv%*QE=jSoDX7$iNkC13=!IB^ oBuhYBKxIirejcjs;?%^V8}dp{XRj%VZsmu)8ighUD9K z)kq^0axjdlHw)(Op>z~Z*;VCTN18u zN9S!|j#S_oMY82PHGu2Dr*HYV`(KSf^G-Pi2p$JbukuhU54y{Qy{U?z|nL~ZCJaW1KiJ7t9Q>1 z0_S*imYK_Og)H3nm-%|y`tG$}&60Pd2O}g`I+>q6nWRCe`Dq#)v>|gC>IoER{Q{Ue Fb(0eTmzw|p diff --git a/searchindex.js b/searchindex.js index e0ebb69..2944c35 100644 --- a/searchindex.js +++ b/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles": {"API details": [[0, "api-details"]], "Advanced usage": [[0, "advanced-usage"]], "Logging": [[0, "logging"]], "MOTIS utl module documentation": [[0, null]]}, "docnames": ["index"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["index.rst"], "indexentries": {"utl::log (c++ function)": [[0, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", false]]}, "objects": {"": [[0, 0, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log"], [0, 1, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log::Args"], [0, 2, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log::args"], [0, 2, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log::ctx"], [0, 2, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log::fmt_str"], [0, 2, 1, "_CPPv4IDpEN3utl3logEvK9log_levelPKcN3fmt13format_stringIDp4ArgsEEDpRR4Args", "utl::log::level"]]}, "objnames": {"0": ["cpp", "function", "C++ function"], "1": ["cpp", "templateParam", "C++ template parameter"], "2": ["cpp", "functionParam", "C++ function parameter"]}, "objtypes": {"0": "cpp:function", "1": "cpp:templateParam", "2": "cpp:functionParam"}, "terms": {"42": 0, "By": 0, "The": 0, "abnorm": 0, "about": 0, "also": 0, "an": 0, "applic": 0, "ar": 0, "arg": 0, "argument": 0, "behavior": 0, "can": 0, "char": 0, "com": 0, "const": 0, "contain": 0, "context": 0, "ctx": 0, "current": 0, "debug": 0, "default": 0, "effici": 0, "error": 0, "extra": 0, "filenam": 0, "fmt": 0, "fmt_str": 0, "follow": 0, "format_str": 0, "function": 0, "get": 0, "github": 0, "given": 0, "hello": 0, "hood": 0, "howev": 0, "http": 0, "i": 0, "import": 0, "info": 0, "inform": 0, "insert": 0, "int": 0, "level": 0, "line": 0, "log_level": 0, "logf": 0, "macro": 0, "main": 0, "messag": 0, "modal": 0, "multi": 0, "new": 0, "normal": 0, "number": 0, "onli": 0, "open": 0, "own": 0, "pass": 0, "plan": 0, "platform": 0, "prefix": 0, "produc": 0, "program": 0, "project": 0, "repositori": 0, "resourc": 0, "rout": 0, "simpl": 0, "simplest": 0, "softwar": 0, "sourc": 0, "specifi": 0, "string": 0, "support": 0, "system": 0, "templat": 0, "them": 0, "thi": 0, "transport": 0, "typenam": 0, "under": 0, "us": 0, "util": 0, "variabl": 0, "void": 0, "wai": 0, "when": 0, "you": 0, "your": 0}, "titles": ["MOTIS utl module documentation"], "titleterms": {"advanc": 0, "api": 0, "detail": 0, "document": 0, "log": 0, "modul": 0, "moti": 0, "usag": 0, "utl": 0}}) \ No newline at end of file +Search.setIndex({"alltitles": {"API details": [[0, "api-details"]], "Advanced usage": [[0, "advanced-usage"]], "Logging": [[0, "logging"]], "MOTIS utl module documentation": [[0, null]]}, "docnames": ["index"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["index.md"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"42": 0, "The": 0, "abnorm": 0, "about": 0, "aggreg": 0, "an": 0, "applic": 0, "ar": 0, "argument": 0, "attr": 0, "behavior": 0, "can": 0, "cannot": 0, "code": 0, "com": 0, "contain": 0, "context": 0, "debug": 0, "directori": 0, "do": 0, "doxygen": 0, "doxygenfunct": 0, "effici": 0, "error": 0, "except": 0, "extra": 0, "find": 0, "first": 0, "fmt": 0, "follow": 0, "format": 0, "from": 0, "function": 0, "github": 0, "h": 0, "hello": 0, "here": 0, "http": 0, "i": 0, "import": 0, "includ": 0, "info": 0, "inform": 0, "initi": 0, "insert": 0, "insid": 0, "int": 0, "key1": 0, "key2": 0, "level": 0, "librari": 0, "line": 0, "main": 0, "messag": 0, "metadata": 0, "modal": 0, "multi": 0, "myctx": 0, "normal": 0, "onli": 0, "open": 0, "origin": 0, "output": 0, "paramet": 0, "pass": 0, "perform": 0, "plan": 0, "platform": 0, "possibl": 0, "produc": 0, "program": 0, "project": 0, "provid": 0, "repositori": 0, "rout": 0, "rule": 0, "simpl": 0, "simplest": 0, "softwar": 0, "sourc": 0, "specifi": 0, "string": 0, "support": 0, "system": 0, "them": 0, "thi": 0, "those": 0, "transport": 0, "us": 0, "util": 0, "value1": 0, "value2": 0, "variabl": 0, "variou": 0, "wai": 0, "want": 0, "we": 0, "when": 0, "wherev": 0, "wrap": 0, "xml": 0, "you": 0}, "titles": ["MOTIS utl module documentation"], "titleterms": {"advanc": 0, "api": 0, "detail": 0, "document": 0, "log": 0, "modul": 0, "moti": 0, "usag": 0, "utl": 0}}) \ No newline at end of file