Agent Skillsnetalertx/NetAlertX › netalertx-logging-standards

netalertx-logging-standards

GitHub

定义NetAlertX后端Python代码的日志规范,包括导入方式、函数签名、日志级别使用场景、消息格式及禁止行为,确保日志记录的一致性与安全性。

.github/skills/logging-standards/SKILL.md netalertx/NetAlertX

Trigger Scenarios

添加新的日志语句 修改现有日志逻辑 审查代码中的日志实现

Install

npx skills add netalertx/NetAlertX --skill netalertx-logging-standards -g -y
More Options

Non-standard path

npx skills add https://github.com/netalertx/NetAlertX/tree/main/.github/skills/logging-standards -g -y

Use without installing

npx skills use netalertx/NetAlertX@netalertx-logging-standards

指定 Agent (Claude Code)

npx skills add netalertx/NetAlertX --skill netalertx-logging-standards -a claude-code -g -y

安装 repo 全部 skill

npx skills add netalertx/NetAlertX --all -g -y

预览 repo 内 skill

npx skills add netalertx/NetAlertX --list

SKILL.md

Frontmatter
{
    "name": "netalertx-logging-standards",
    "description": "Logging conventions for NetAlertX backend Python code. Use this when adding, modifying, or reviewing log statements."
}

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

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.

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.

Version History

  • 716a41a Current 2026-08-27 19:51

Same Skill Collection

.gemini/skills/devcontainer-management/SKILL.md
.gemini/skills/logging-standards/SKILL.md
.gemini/skills/mcp-activation/SKILL.md
.gemini/skills/pr-analysis/SKILL.md
.gemini/skills/project-navigation/SKILL.md
.gemini/skills/settings/SKILL.md
.gemini/skills/skills-index/SKILL.md
.gemini/skills/testing-workflow/SKILL.md
.github/skills/api-development/SKILL.md
.github/skills/authentication/SKILL.md
.github/skills/code-standards/SKILL.md
.github/skills/database-patterns/SKILL.md
.github/skills/database-reset/SKILL.md
.github/skills/devcontainer-configs/SKILL.md
.github/skills/devcontainer-services/SKILL.md
.github/skills/devcontainer-setup/SKILL.md
.github/skills/docker-build/SKILL.md
.github/skills/docker-prune/SKILL.md
.github/skills/mcp-activation/SKILL.md
.github/skills/plugin-run-development/SKILL.md
.github/skills/pr-analysis/SKILL.md
.github/skills/project-navigation/SKILL.md
.github/skills/sample-data/SKILL.md
.github/skills/settings-management/SKILL.md
.github/skills/skills-overview/SKILL.md
.github/skills/testing-workflow/SKILL.md

Metadata

Files
0
Version
716a41a
Hash
202de5d1
Indexed
2026-08-27 19:51

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-29 04:27
浙ICP备14020137号-1 $Carte des visiteurs$