Skip to content

Commit

Permalink
Documented log levels and log types
Browse files Browse the repository at this point in the history
  • Loading branch information
checkroom committed Nov 21, 2024
1 parent aea7b4a commit dbebb49
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/for-developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,31 @@ As for memory allocations, spawning small dynamic objects is also discouraged. I

### About log levels

Internally these are the log levels supported and their relative semantics:
- **INFO** to present informational messages, often as a result of user requests
- **OK** to notify that a certain operation completed successfully.
- **WARNING** to notify that a certain operation was not able to fully succeed, something should be fixed, but everything is fine.
- **CONTINUE** to notify that a certain operation was skipped by design.
- **PANIC** to notify that a certain operation failed in a way which cannot be recovered (but the application can still run)
- **LOG** to introduce a log without any further connotation.

For example, loading a remote resource:
- If the file was already cached, a `continue` message will be notified
- If no proper answer has been received from the remote host, a `panic` message is generated, since that content cannot be recovered
- If everything loaded fine, an `ok` message can be used
- If the component is using features which are not allowed by policies, `warning` messages can be generated.

Log levels are:
- **NORMAL** to be emitted when running the program normally
- **SILENT** to be emitted when running the program even in silent mode
- **VERBOSE** to be emitted when running the program in verbose mode only
- **DEBUG** to be emitted always when running a debug build or in debugging mode.

Each messagge must specify their semantic type and log level (normal by default). Usually:
- `panic` messages have a `silent` log level
- `ok` and `continue` messages are usually `verbose`
- `info`, `warning` and `log` are usually `normal`

## Logging

### Debug logging
Expand Down

0 comments on commit dbebb49

Please sign in to comment.