netalertx-logging-standards

Enforces logging conventions for NetAlertX backend Python code using the mylog function.

7.0k|426|Updated Dec 23, 2021
One-click install
npx skills add https://github.com/netalertx/NetAlertX --skill netalertx-logging-standards
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netalertx-logging-standards
Source: https://github.com/netalertx/NetAlertX/tree/main/.github/skills/logging-standards
Command: npx skills add https://github.com/netalertx/NetAlertX --skill netalertx-logging-standards

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent logging across a Python codebase makes debugging painful and log output noisy. This Skill standardizes how log statements are written in the NetAlertX backend so every message follows the same import, level, format, and timestamp conventions.

Core Features & Use Cases

  • Standardized Logger Usage: Mandates the mylog function from the logger module instead of Python's built-in logging or print() calls.
  • Five-Level Severity Model: Defines when to use none, minimal, verbose, debug, and trace levels, from fatal errors down to per-item tracing.
  • Message Formatting Rules: Requires [Module] tag prefixes, f-strings inside list arguments, and automatic timestamps via timeNowTZ.
  • Use Case: When adding a new device-handling feature, use this Skill to write log statements like mylog("debug", [f"[device_handling] Processing MAC: {mac}"]) that match project conventions and pass code review.

Quick Start

Ask the AI to add or review log statements in a NetAlertX Python file following the project's logging standards.

Frequently Asked Questions about netalertx-logging-standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add log statements in NetAlertX Python code?

Import mylog from the logger module and call it with a level and a message or list of values, such as mylog("debug", [f"[Module] message"]). Never import Python's logging module directly or use print() in server code.

What log levels does the NetAlertX mylog function support?

Five levels from least to most verbose: none (always printed, for fatal errors), minimal (state transitions), verbose (informational progress), debug (developer detail), and trace (per-item granularity like SQL queries).

Should I add timestamps to NetAlertX log messages?

No. The mylog and file_print functions automatically prepend the current local-timezone time via timeNowTZ. Adding a manual timestamp inside the message would duplicate it.

Can I log SQL queries in NetAlertX backend code?

Only at the trace level. Full SQL query strings must not appear at none or minimal levels, and raw user input must be sanitized before logging to avoid leaking sensitive data.

Where are NetAlertX log files written?

Logs go to {logPath}/app.log, where logPath comes from const.py and resolves to /tmp/logs at runtime. Never hardcode this path in application code.