CtrlK
BlogDocsLog inGet started
Tessl Logo

logging-standards

Logging conventions for NetAlertX backend Python code. Use this when adding, modifying, or reviewing log statements.

71

Quality

86%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Logging Standards

Import

from logger import mylog

Never import logging directly in application code. Use mylog exclusively.

Function Signature

mylog(level, message_or_list)

message_or_list can be a plain string or a list of values — the logger joins them with spaces.

Log Levels

Levels from least to most verbose (higher number = more output):

LevelNumericWhen to use
"none"0Always printed regardless of user setting. Reserve for startup, fatal errors, and one-time permission checks.
"minimal"1Important state transitions visible by default (scan start/end, plugin finish, restart).
"verbose"2Informational progress — what the system is doing without clutter (e.g. "No changes to report").
"debug"3Developer-level detail — loop decisions, branch taken, counts.
"trace"4Granular per-item tracing — individual device rows, SQL queries, raw values.

Message Format

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))

Timestamp

mylog / file_print prepend the current local-timezone time automatically via timeNowTZ. Do not add a timestamp manually inside the message.

What NOT to Log

  • Do not log raw user input without sanitization.
  • Do not log full SQL query strings at "none" or "minimal" — use "trace" at most.
  • Do not use print() in server code — use mylog. file_print is an internal helper; do not call it directly.

Log File Location

Written to {logPath}/app.log (logPath from const.py/tmp/logs at runtime). Do not hardcode this path.

Repository
netalertx/NetAlertX
Last updated
First committed

Is this your skill?

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.