store: Missing logger import causes NameError in Python modules

This commit is contained in:
Cal Corum 2026-02-13 14:35:13 -06:00
parent 17d15354a1
commit 6140406d94

View File

@ -0,0 +1,23 @@
---
id: 7b6d183b-e221-471a-8078-e8639ebdd55a
type: fix
title: "Missing logger import causes NameError in Python modules"
tags: [python, logging, bug, nameerror, fix, troubleshooting]
importance: 0.5
confidence: 0.8
created: "2026-02-13T20:35:13.483029+00:00"
updated: "2026-02-13T20:35:13.483029+00:00"
---
Common bug when adding logging to existing Python code: calling logger.info() without importing logging module.
Error: NameError: name 'logger' is not defined
Fix:
import logging
logger = logging.getLogger(__name__)
Always add both lines at top of module when adding logging.
In discord bot config.py, save() and add_project() methods called logger.info() but module lacked import. Added imports, committed, restarted service.