Introduce the fish log, a replacement for debug()

This adds a new mechanism for logging, intended to replace debug().

The entry points are FLOG and FLOGF. FLOG can be used to log a sequence of
arguments, FLOGF is for printf-style formatted strings.

Each call to FLOG and FLOGF requires a category. If logging for a category
is not enabled, there is no effect (and arguments are not evaluated).

Categories may be enabled on the command line via the -d option.
This commit is contained in:
ridiculousfish
2019-04-20 00:15:51 -07:00
parent b405b979ec
commit 63a16befd4
6 changed files with 276 additions and 2 deletions

View File

@@ -22,6 +22,8 @@ The following options are available:
- ``-d`` or ``--debug-level=DEBUG_LEVEL`` specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1.
- ``-o`` or ``--debug-output=path`` Specify a file path to receive the debug output. The default is stderr.
- ``-i`` or ``--interactive`` specify that fish is to run in interactive mode
- ``-l`` or ``--login`` specify that fish is to run as a login shell
@@ -32,6 +34,8 @@ The following options are available:
- ``--print-rusage-self`` when fish exits, output stats from getrusage
- ``--print-debug-categories`` outputs the list of debug categories, and then exits.
- ``-v`` or ``--version`` display version and exit
- ``-D`` or ``--debug-stack-frames=DEBUG_LEVEL`` specify how many stack frames to display when debug messages are written. The default is zero. A value of 3 or 4 is usually sufficient to gain insight into how a given debug call was reached but you can specify a value up to 128.