← スキル一覧に戻る

logger-generator
by terencefan
⭐ 0🍴 0📅 2026年1月13日
SKILL.md
name: logger-generator description: Generates production-grade, high-availability logging modules for any programming language (Python, TypeScript, Go, etc.). Enforces best practices like rotation, formatting, and minimal dependencies.
Logger Generator Skill
This skill guides the creation of robust, "out-of-the-box" logging utilities for any software project. It ensures that generated logging modules meet production standards for observability, reliability, and ease of use, regardless of the target programming language.
When to Use This Skill
Use this skill when:
- Setting up a new project (Python, Node.js, Go, Rust, etc.) and need a reliable logger.
- Replacing simple
printorconsole.logstatements with a proper logging system. - The user asks for a "logging module", "log util", or "logger setup".
- You need to standardize log collection across different services in a polyglot repository.
Core Requirements Checklist
Any logger generated using this skill MUST satisfy the following criteria unless explicitly overridden:
- Stand-alone Module: Must be a single, portable file (e.g.,
logger.py,logger.ts,logger.go). - Dual Channel Output:
- Console: With COLOR coding for log levels (Human readable).
- File: Plain text, structured, standard encoding (Machine readable).
- Complete Log Levels:
DEBUG,INFO,WARN/WARNING,ERROR,FATAL/CRITICAL. - Standardized Format:
- Timestamp (ISO-like or
YYYY-MM-DD HH:MM:SS.mmm). - Log Level (Aligned).
- Source Location (File + Line Number).
- Component/Module Name.
- Message.
- Timestamp (ISO-like or
- Log Rotation:
- Automatic rotation (Time-based/Daily or Size-based).
- Automatic cleanup (Retention policy, e.g., keep last 30 days).
- Configuration:
- Support default "Zero Config" (Global Singleton).
- Support custom instances (Configurable paths, levels).
- Support UTF-8/Unicode characters specifically.
- Robustness:
- Thread-safe / Async-safe where applicable.
- No external dependencies if possible (prefer Standard Lib). If external libs are needed (e.g., Node.js), minimize them.
- Traceability:
- Error logs must support printing Stack Traces / Tracebacks.
Language-Specific Implementation Guides
Python
- Library:
logging(Standard Lib). - Rotation:
logging.handlers.TimedRotatingFileHandler. - Colors: ANSI escape codes in a custom
logging.Formatter. - Pattern: Singleton instance with
getLogger().
TypeScript / Node.js
- Library: Prefer
winstonfor robust features, or a custom wrapper aroundfs+consolefor zero-dependency needs. - Rotation:
winston-daily-rotate-file(if using winston). - Colors:
chalkor simple ANSI codes. - Pattern: Export a
Loggerclass and a defaultloggerinstance.
Go (Golang)
- Library:
log/slog(Standard Lib > 1.21) orzap(High perf). - Rotation: Go stdlib does not rotate. Use
gopkg.in/natefinch/lumberjack.v2for file rotation. - Pattern:
MultiWriterfor splitting output toos.Stdoutand file.
Example Output Format
2024-03-20 10:15:30.123 | INFO | main.py:45 | auth_service | Server started on port 8080
2024-03-20 10:15:32.456 | ERROR | db.py:102 | db_pool | Connection failed (Retrying...)
Generation Protocol
- Identify Language: Confirm the target language (Python, TS, Go, etc.).
- Select Strategy: Choose between "Standard Library Only" (preferred for simple scripts) or "Industry Standard Package" (preferred for large apps).
- Generate Code: Write the module implementing the [Core Requirements Checklist].
- Verify: Ensure usage examples cover:
- Basic usage (Global logger).
- Configuration (Custom file paths).
- Exception handling (Try-Catch logging).
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です