-
-
Notifications
You must be signed in to change notification settings - Fork 763
Description
Description
We would like to enhance Task logger to provide more debugging support when developing Taskfiles. In particular gaining additional information on Task processing logic (generates, for, sources ...) and variable values (where/how they are arrived at). The reason for this is that we would like to be able to fix issues with a Taskfile, or its usage, based on the collected log and hopefully without any additional debugging efforts.
The suggestion would be along these lines:
- Add the Go log/slog package to the logging subsystem.
- Refactor the existing logging to overlay onto the log/slog system. No change in behaviour.
- Extend/add to the CLI flags with additional log filtering capabilities.
Log levels of log/slog might map into the existing Task logging, such as:
- 0 = silent (only console and errors)
- 1 = normal
- 2 = verbose
- 3 = debug log ( info about processing logic, variable values etc.)
- 4 = trace (very low level logging, code path tracing)
The CLI support could extended any number of ways. This would be sufficient for our case:
task // uses level 1
task --silent // uses level 0
task --verbose // uses level 2
task --verbose 3 // uses level 3 for all tasks
task --verbose 3:taskfoo // uses level 3/debug for task "taskfoo", 2/verbose for other tasks
task --verbose 0:*,4:taskfoo // uses level 4/tarce for task "taskfoo" and 0/silent for other tasks.
Of course that hijacks the --verbose flag ... one could also add a new flag (--log for instance).