1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-06-25 08:38:43 +00:00

Make logging.basicConfig conditional

This commit is contained in:
Gertjan van den Burg 2025-01-05 22:40:29 +00:00
parent 0a1d3841f1
commit 7fd23a60f6

View File

@ -13,9 +13,10 @@ from typing import Any, Dict, Optional, Type
import importlib_resources
import yaml
logging.basicConfig()
logger = logging.getLogger(__name__)
if environ.get("ESCPOS_CAPABILITIES_DEBUG", 0):
logging.basicConfig()
logger = logging.getLogger(__name__)
pickle_dir = environ.get("ESCPOS_CAPABILITIES_PICKLE_DIR", mkdtemp())
pickle_path = path.join(pickle_dir, f"{platform.python_version()}.capabilities.pickle")
# get a temporary file from importlib_resources if no file is specified in env