{"id":"5f268396-565c-43a2-b97d-512dd6506ec1","shortId":"zQ6GQy","kind":"skill","title":"python-logging","tagline":"Use when choosing or configuring Python logging, especially deciding between stdlib logging and loguru for apps or CLIs.","description":"# Python Logging\n\n## Overview\n\nChoose the logging system based on project boundaries. Core principle: use stdlib logging for reusable libraries and ecosystem integration; use loguru only when an app or CLI owns the whole logging surface.\n\n## Use When\n\n- Choosing between stdlib `logging` and `loguru`.\n- Configuring log levels, handlers, formatters, or structured context.\n- Adding logging to libraries, apps, CLIs, or services.\n- Deciding how logging should interact with ops tooling.\n\n## Quick Reference\n\n| Need | Use |\n| --- | --- |\n| Library or long-lived service | stdlib `logging` |\n| Simple app or CLI | `loguru` |\n| Integrations (Sentry/OTel) | stdlib `logging` |\n| Mixed library + app | stdlib in library; app config at boundary |\n\n## Decision Rules\n\nUse stdlib `logging` when:\n- Building a reusable library\n- You need handler hierarchies or integration with ops tooling\n- You expect callers to configure logging\n\nUse `loguru` when:\n- You want minimal setup and readable output\n- You are building a small app or CLI\n- You control process startup and logging configuration\n\n## Workflow\n\n1. Decide whether the code is a library, service, CLI, or one-off app.\n2. Keep libraries passive: create `logging.getLogger(__name__)` and do not call `basicConfig()`.\n3. Configure handlers and levels once at the application entry point.\n4. Avoid mixing stdlib logging and loguru unless the app owns the bridge and boundary.\n\n## Example\n\nStdlib logger setup:\n```python\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\nlogger.info(\"App started\")\n```\n\n## Common Mistakes\n\n- Forcing loguru in a reusable library.\n- Mixing two logging systems without a clear boundary.\n- Calling `basicConfig()` inside imported library modules.\n- Creating handlers repeatedly in functions that run more than once.\n\n## Red Flags\n\n- Logging recommendations with no rationale for library vs app use.\n- Global logging setup hidden in modules that are imported by tests or other applications.\n\n## References\n\n- `references/logging.md` - stdlib logging patterns\n- `references/loguru.md` - loguru patterns","tags":["python","logging","skills","narumiruna","agent-skills"],"capabilities":["skill","source-narumiruna","skill-python-logging","topic-agent-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/narumiruna/skills/python-logging","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add narumiruna/skills","source_repo":"https://github.com/narumiruna/skills","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (2,116 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:13:46.861Z","embedding":null,"createdAt":"2026-05-18T19:13:46.861Z","updatedAt":"2026-05-18T19:13:46.861Z","lastSeenAt":"2026-05-18T19:13:46.861Z","tsv":"'1':171 '2':186 '3':198 '4':209 'ad':73 'app':19,49,77,102,112,116,160,185,218,238,282 'applic':206,297 'avoid':210 'base':29 'basicconfig':197,257 'boundari':32,119,223,255 'bridg':221 'build':126,157 'call':196,256 'caller':141 'choos':6,25,59 'clear':254 'cli':51,104,162,180 'clis':21,78 'code':175 'common':240 'config':117 'configur':8,65,143,169,199 'context':72 'control':164 'core':33 'creat':190,262 'decid':12,81,172 'decis':120 'ecosystem':42 'entri':207 'especi':11 'exampl':224 'expect':140 'flag':273 'forc':242 'formatt':69 'function':266 'global':284 'handler':68,132,200,263 'hidden':287 'hierarchi':133 'import':229,259,292 'insid':258 'integr':43,106,135 'interact':85 'keep':187 'level':67,202,232 'librari':40,76,93,111,115,129,178,188,247,260,280 'live':97 'log':3,10,15,23,27,37,55,62,66,74,83,100,109,124,144,168,213,230,250,274,285,301 'logger':226,234 'logger.info':237 'logging.basicconfig':231 'logging.getlogger':191,235 'logging.info':233 'loguru':17,45,64,105,146,215,243,304 'long':96 'long-liv':95 'minim':150 'mistak':241 'mix':110,211,248 'modul':261,289 'name':192,236 'need':91,131 'one':183 'one-off':182 'op':87,137 'output':154 'overview':24 'own':52,219 'passiv':189 'pattern':302,305 'point':208 'principl':34 'process':165 'project':31 'python':2,9,22,228 'python-log':1 'quick':89 'rational':278 'readabl':153 'recommend':275 'red':272 'refer':90,298 'references/logging.md':299 'references/loguru.md':303 'repeat':264 'reusabl':39,128,246 'rule':121 'run':268 'sentry/otel':107 'servic':80,98,179 'setup':151,227,286 'simpl':101 'skill' 'skill-python-logging' 'small':159 'source-narumiruna' 'start':239 'startup':166 'stdlib':14,36,61,99,108,113,123,212,225,300 'structur':71 'surfac':56 'system':28,251 'test':294 'tool':88,138 'topic-agent-skills' 'two':249 'unless':216 'use':4,35,44,57,92,122,145,283 'vs':281 'want':149 'whether':173 'whole':54 'without':252 'workflow':170","prices":[{"id":"7213cf46-9f28-4873-ae5e-c56b6a665cfc","listingId":"5f268396-565c-43a2-b97d-512dd6506ec1","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"narumiruna","category":"skills","install_from":"skills.sh"},"createdAt":"2026-05-18T19:13:46.861Z"}],"sources":[{"listingId":"5f268396-565c-43a2-b97d-512dd6506ec1","source":"github","sourceId":"narumiruna/skills/python-logging","sourceUrl":"https://github.com/narumiruna/skills/tree/main/skills/python-logging","isPrimary":false,"firstSeenAt":"2026-05-18T19:13:46.861Z","lastSeenAt":"2026-05-18T19:13:46.861Z"}],"details":{"listingId":"5f268396-565c-43a2-b97d-512dd6506ec1","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"narumiruna","slug":"python-logging","github":{"repo":"narumiruna/skills","stars":7,"topics":["agent-skills"],"license":"mit","html_url":"https://github.com/narumiruna/skills","pushed_at":"2026-05-17T11:15:28Z","description":null,"skill_md_sha":"c824a8c089482d0de6d666e50ab8ff69db947841","skill_md_path":"skills/python-logging/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/narumiruna/skills/tree/main/skills/python-logging"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"python-logging","description":"Use when choosing or configuring Python logging, especially deciding between stdlib logging and loguru for apps or CLIs."},"skills_sh_url":"https://skills.sh/narumiruna/skills/python-logging"},"updatedAt":"2026-05-18T19:13:46.861Z"}}