tonyandrewmeyer/cantrip/charm-logging
Claude Code and agent skill by tonyandrewmeyer/cantrip
- community
- ext:[{"type":"config","description":"Configuration overrides"}]
Checking that the SKILL.md file is still in the repository.
Charm logging conventions — log levels, message formatting, tense, printf-style templating, common pitfalls
Install
npx vskill@latest install tonyandrewmeyer/cantrip/charm-loggingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as tonyandrewmeyer/cantrip/charm-logging.
Charm Logging
These guidelines standardise logging patterns across the charm ecosystem so logs are useful both at development time and during production operation. Logging levels follow the Python logging module. Based on Canonical spec OB061.
Adapted from thecharm-loggingskill intonyandrewmeyer/charming-with-claude, CC BY 4.0 (Tony Meyer, 2025).Reformatted for cantrip's bundled-skill frontmatter; contentotherwise unchanged. See Provenance at the foot of this skill forthe source link.
Log Levels
DEBUG
Purpose: detailed information for debugging or troubleshooting.
- Default Juju
debug-loglevel is INFO, so DEBUG messages are typically not seen. - Do not assume DEBUG messages are used for alert rules.
- Do not assume DEBUG messages are stored long-term.
- Note: logs are still sent to Juju which filters by level config — do not assume expensive DEBUG logging is free.
Examples:
- Executed commands, functions, methods; internal variable values.
- Raw responses from external services or API calls (redact secrets).
- Configuration values for troubleshooting.
INFO
Purpose: record of the normal operation of the charm. This is the default Juju debug-log level.
Examples:
- Starting or stopping a service.
- Successful completion of an action.
- Important milestones or significant events.
- System health checks or status reports.
WARNING
Purpose: potential issues that may lead to errors if not addressed.
Examples:
- Errors the application can recover from without significant impact.
- Missing config file, using defaults.
- Retrying a failed connection.
ERROR
Purpose: a failure preventing part of the workload from working properly, without completely breaking its core service.
Examples:
- Failed to create/update a non-essential resource (config file, certificates, alert rules).
- Validation error preventing user action.
- Mismatch between workload state and charm model data.
- Caught exceptions signalling non-transient issues (consider
logger.exception). - Network communication errors (timeouts, DNS failures).
- External API/service failures.
CRITICAL
Purpose: a severe error breaking the charm's core service, requiring immediate attention.
Examples:
- Workload failed to start; upgrade failed.
- Workload is down for unknown reasons.
- Crucial configuration missing without fallback defaults.
- Health endpoint reports internal error.
Deprecation warnings
Use warnings.warn rather than logging.warn — both appear in Juju logs, but warnings provides more control and is designed for this use case.
Message Formatting
Be clear, direct, and concise
Avoid ambiguity. Messages should be understood without additional context.
Let the renderer determine capitalisation and punctuation
Verb tense
| When | Tense | Example | |
|---|---|---|---|
| Before an action | Future simple | "alertmanager service will be restarted" | |
| After an action | Past simple | "alertmanager service restarted" | |
| During an action (sequence) | Present continuous | "updating ingress for relation 'ingress:10'" — only if a follow-up message is guaranteed |
Avoid present continuous unless it is part of a guaranteed sequence with a clear reference between start and end messages.
Make each message self-contained
The meaning of a log line should not depend on previous or subsequent lines. Include enough context to be useful during debugging or auditing.
Include cause and effect
Explain not only what happened, but why:
Include relevant identifiers
Operation IDs, unit names, resource paths:
Avoid duplication and noise
- Do not log the same information repeatedly.
- Do not log what Juju already logs (e.g. that an event is running).
- Each message should add value.
Templating
Always use printf-style percentage formatting, never f-strings.
The logging module formats lazily, so the expensive string only materialises if the log line is actually emitted. f-strings build the string eagerly regardless of level.
Provenance
Adapted from the `charm-logging` skill in `tonyandrewmeyer/charming-with-claude`, CC BY 4.0 (Tony Meyer, 2025). Content reformatted for cantrip's bundled-skill frontmatter; otherwise unchanged.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/cantrip/skills/charm-logging/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
configConfiguration overrides
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tonyandrewmeyer/cantrip/charm-logging)