Logging conventions for NetAlertX backend Python code. Use this when adding, modifying, or reviewing log statements.
71
86%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
from logger import mylogNever import logging directly in application code. Use mylog exclusively.
mylog(level, message_or_list)message_or_list can be a plain string or a list of values — the logger joins them with spaces.
Levels from least to most verbose (higher number = more output):
| Level | Numeric | When to use |
|---|---|---|
"none" | 0 | Always printed regardless of user setting. Reserve for startup, fatal errors, and one-time permission checks. |
"minimal" | 1 | Important state transitions visible by default (scan start/end, plugin finish, restart). |
"verbose" | 2 | Informational progress — what the system is doing without clutter (e.g. "No changes to report"). |
"debug" | 3 | Developer-level detail — loop decisions, branch taken, counts. |
"trace" | 4 | Granular per-item tracing — individual device rows, SQL queries, raw values. |
Prefix every message with a [Module] tag matching the file/function context:
mylog("debug", [f"[device_handling] Processing MAC: {mac}"])
mylog("verbose", ["[Scan] Scan complete — devices updated:", count])Use f-strings inside a list element, not string concatenation:
# Correct
mylog("debug", [f"[NIC] parent={parent_mac} nic_online={nic_online}"])
# Avoid
mylog("debug", "[NIC] parent=" + parent_mac + " nic_online=" + str(nic_online))mylog / file_print prepend the current local-timezone time automatically via timeNowTZ. Do not add a timestamp manually inside the message.
"none" or "minimal" — use "trace" at most.print() in server code — use mylog. file_print is an internal helper; do not call it directly.Written to {logPath}/app.log (logPath from const.py → /tmp/logs at runtime). Do not hardcode this path.
014b960
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.