Skip to content

Commit

Permalink
contrib: Add a page about the debug logging facilities
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed Feb 13, 2024
1 parent 47a0dbb commit f79220f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions contributing/Debugging/About Debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ This section is intended to document how to place debugger breakpoints in the Ta

## Current Content

- [[Console logging facilities in Tasks]]
- [[How do I enable hidden debugging and visualisation facilities]]
25 changes: 25 additions & 0 deletions contributing/Debugging/Console logging facilities in Tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Console logging facilities in Tasks

The source file [src/lib/logging.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/lib/logging.ts) provides a logging facility that writes to the developer console.

## Enabling debug logging

The `loggingOptions` section in the file `.obsidian/plugins/obsidian-tasks-plugin/data.json` vault determines the level of detail written out by Tasks.

For example, change all the `info` values to `debug`.

The available levels are:

- `error`: Only show errors.
- `warn`: Show warnings, and all above.
- `info`: Show informational messages, and all above.
- `debug`: Show debug messages and above.
- `trace`: A `trace` message shows the call-stack to the log message.

See a sample [data.json](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/resources/sample_vaults/Tasks-Demo/.obsidian/plugins/obsidian-tasks-plugin/data.json) file.

## Adding logging to new locations

New logging locations need to be added to `loggingOptions` in [src/Config/Settings.ts](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/Config/Settings.ts), so that developers/users can easily adjust the logging levels.

For now, if you wish to add new logging, please search the source code for uses of `logging.getLogger()`.

0 comments on commit f79220f

Please sign in to comment.