Skip to content

Commit 04d44d9

Browse files
AlomirdlebauerCopilot
authored
SIP300 update docs logging functions and usage section (#308)
* SIP300 update docs logging functions and usage section Updated logging function descriptions and usage guidelines to be consistent with #300 * Update logging.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update logging.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update logging.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Remove filter, as it just stalls doc-only PRs --------- Co-authored-by: David LeBauer <dlebauer@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c65e093 commit 04d44d9

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
branches:
66
- master
77
pull_request:
8-
paths-ignore:
9-
# If we ONLY have files in /docs, don't run the build and test
10-
- 'docs/**'
118

129
jobs:
1310

docs/developer-guide/logging.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,24 @@ and implemented in `common/logging.c`.
1010
- 1: Always on (not suppressed).
1111
- 2: Always on and includes `file:line`.
1212

13+
## Functions
1314

14-
## Usage
15+
- `logInfo`: Level 0; routine progress, expected or supported behavior, configuration summaries, and transparency messages.
16+
- `logWarning`: Level 0; conditions that may affect validity or reliability, or likely require user attention.
17+
- `logTest`: Level 1; deterministic messages for tests/CI; not user-facing.
18+
- `logError`: Level 1; non-recoverable problems: the run cannot continue, state is invalid, or output cannot be trusted.
19+
- `logInternalError`: Level 2; errors that should never happen; include details and ask to report.
20+
- `logAppend`: Continue the current log line (for example, to add more text after a `logInfo` call) without starting a new prefix.
21+
22+
### Choosing a function
1523

16-
- `logInfo`: Level 0; routine progress, configuration summaries, expected state changes.
17-
- `logWarning`: Level 0; Recoverable issues or surprises; fallbacks, deprecated/ignored inputs.
18-
- `logTest`: Level 1; Deterministic messages for tests/CI; not user-facing.
19-
- `logError`: Level 1; Non-recoverable problems preventing correct operation; abort/exit or skip major task.
20-
- `logInternalError`: Level 2; Errors that should never happen; include details and ask to report.
24+
Rule of thumb:
25+
26+
- Use `logError` if the run should stop.
27+
- Use `logWarning` if the user should probably stop and check the run.
28+
- Use `logInfo` if the run can proceed and the message is mainly for transparency.
29+
30+
## Usage
2131

2232
1. Include the header:
2333
```c
@@ -39,9 +49,7 @@ and implemented in `common/logging.c`.
3949
[ERROR ] Missing required parameter: bar
4050
[ERROR (INTERNAL)] (myfile.c:123) Unexpected state: 5
4151
```
42-
43-
44-
## Notes:
52+
## Notes
4553
4654
- Each log prints a fixed prefix (e.g., `[INFO ]`, `[WARNING]`, `[ERROR ]`).
4755
- Messages use `printf`-style formatting. Include `\n` yourself if you want a newline.

0 commit comments

Comments
 (0)