diff options
author | Tor Lillqvist <tml@collabora.com> | 2016-08-18 15:31:25 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-08-18 15:37:03 +0300 |
commit | ed815a242ef962afa52033a0d94ba6aa4539dd07 (patch) | |
tree | 484dede222210437a57cd38ed31668ac6d6f3d2a /include/sal/log.hxx | |
parent | 0a9123152387f7a742481e9f35401270e29ed695 (diff) |
Add handling of a +RELATIVETIMER flag in the SAL_LOG environment variable
Outputs a timestamp in decimal seconds (with millisecond accuracy).
Simplified the handling of SAL_LOG if no "level" is specified. Now
just a totally unset (or empty) SAL_LOG causes the default of "+WARN"
to be used. Given how the code works, it would have become too
unwieldy to check for all combinations of TIMESTAMP and RELATIVETIMER
but no WARN or INFO.
Change-Id: I7bb5bb665d4e764e7eee447e93486f6467042e97
Diffstat (limited to 'include/sal/log.hxx')
-rw-r--r-- | include/sal/log.hxx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/include/sal/log.hxx b/include/sal/log.hxx index 6ce3bfefb4d7..e879a2ff71e1 100644 --- a/include/sal/log.hxx +++ b/include/sal/log.hxx @@ -231,18 +231,25 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { <switch> ::= <sense><item> <sense> ::= "+"|"-" <item> ::= <flag>|<level>("."<area>)? - <flag> ::= "TIMESTAMP" + <flag> ::= "TIMESTAMP"|"RELATIVETIMER" <level> ::= "INFO"|"WARN" @endverbatim - If the environment variable is unset, or contains no level, the level - setting "+WARN" is assumed instead (which results in all warnings being - output but no infos). If the given value does not match the regular - expression, "+INFO+WARN" is used instead (which in turn results in - everything being output). + If the environment variable is unset, the setting "+WARN" is + assumed instead (which results in all warnings being output but no + infos). If the given value does not match the regular expression, + "+INFO+WARN" is used instead (which in turn results in everything + being output). The "+TIMESTAMP" flag causes each output line (as selected by the level - switch(es)) to be prefixed by a timestamp like 2016-08-18:14:04:43.. + switch(es)) to be prefixed by a timestamp like 2016-08-18:14:04:43. + + The "+RELATIVETIMER" flag causes each output line (as selected by + the level switch(es)) to be prefixed by a relative timestamp in + seconds since the first output line like 1.312. + + If both +TIMESTAMP and +RELATIVETIMER are specified, they are + output in that order. Specifying a flag with a negative sense has no effect. Specifying the same flag multiple times has no extra effect. |