przekierowanie wyjscia na stout i stderr. dodanie ustawiania debugu z konfiguracji dodatku
This commit is contained in:
@@ -16,9 +16,12 @@ def setup_logging():
|
||||
if not os.path.exists(LOGS_DIR):
|
||||
os.makedirs(LOGS_DIR)
|
||||
|
||||
# 3. Stwórz i skonfiguruj handler dla konsoli (poziom INFO)
|
||||
# 3. Stwórz i skonfiguruj handler dla konsoli (poziom INFO lub DEBUG)
|
||||
debug_mode = os.getenv('CONFIG_DEBUG', 'false').lower() == 'true'
|
||||
console_level = logging.DEBUG if debug_mode else logging.INFO
|
||||
|
||||
console_handler = logging.StreamHandler(sys.stdout)
|
||||
console_handler.setLevel(logging.INFO)
|
||||
console_handler.setLevel(console_level)
|
||||
console_formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
|
||||
console_handler.setFormatter(console_formatter)
|
||||
logger.addHandler(console_handler)
|
||||
|
||||
Reference in New Issue
Block a user