You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/prompts/dev.implement-logging.prompt.md
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,28 @@ Audit every Python file in this repository against the logging standards defined
11
11
### Step 1: Discover Python files
12
12
13
13
1. Run `git ls-files '*.py'` to enumerate all tracked Python files.
14
-
2. For each file, note whether it imports a logging library (e.g., `logging`, `structlog`, `loguru`) or contains `logger` / `log` references.
14
+
2. For each file, search for **any** diagnostic output pattern:
15
+
- Logging imports: `logging`, `structlog`, `loguru`, or project logger
16
+
- Direct stderr: `sys.stderr.write`, `sys.stderr.flush`
17
+
- Print to stderr: `print(..., file=sys.stderr)`
18
+
- Print for diagnostics: `print(` used for status/error output
19
+
- Logger references: `logger`, `log`, `_log`
20
+
3. Flag files with diagnostic output that do **not** import the central logger.
15
21
16
22
### Step 2: Assess logging practices
17
23
18
24
For every file that uses logging (or should but does not), evaluate compliance against the categories below. Report each finding and remediate inline where feasible.
19
25
20
26
## Implementation requirements 🛠️
21
27
28
+
### Anti-patterns (flag and fix immediately) 🚫
29
+
30
+
-**Bypassing central logger**: `sys.stderr.write()`, `print(file=sys.stderr)`, or raw `print()` for diagnostic output — route through central logger instead.
31
+
-**Direct logging import**: `import logging` / `logging.getLogger()` instead of project factory — use the central logger factory.
32
+
-**Inline helper functions**: local `_log_*()` wrappers that write directly to stderr rather than delegating to the central service.
33
+
-**Silent failures**: bare `except:` or `except Exception:` without logging.
34
+
-**Mixed output channels**: some modules using central logger while others bypass it.
35
+
22
36
### Principles
23
37
24
38
-**Signal over noise**: logs must capture intent, boundaries, decisions, and failures—not routine execution. Flag verbose or redundant log statements.
@@ -104,5 +118,5 @@ Flag any misuse (e.g., logging an error condition at INFO).
0 commit comments