Coverage for ntnlog / ntn_config.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-21 04:50 +0000

1####################################################################### 

2# 

3# Logging Module Configuration 

4# 

5# Configuration for logging and tracing 

6# 

7####################################################################### 

8 

9from typing import Final 

10from .ntn_levels import Level 

11 

12GLOBAL_LOGGING_ENABLED: Final[bool] = True 

13"""Master on/off switch. When ``False``, all ``Logger`` instances are silenced.""" 

14 

15GLOBAL_LOG_TRACING_ENABLED: Final[bool] = True 

16"""When ``True``, call-stack tracing is enabled for instances that opt in via 

17``enable_log_tracing(True)``.""" 

18 

19GLOBAL_LOG_LEVEL: Final[Level] = Level.INFO 

20"""Minimum severity threshold applied to every ``Logger`` instance that has no 

21instance-level *level* set. Entries below this level are silently dropped.""" 

22 

23GLOBAL_MAX_BYTES: Final[int] = 10_000_000 

24"""Maximum size of a single log file in bytes (default 10 MB) before rotation.""" 

25 

26GLOBAL_BACKUP_COUNT: Final[int] = 1 

27"""Number of rotated backup files to keep alongside the active log file. 

28``0`` deletes the active file on rotation instead of renaming it.""" 

29 

30GLOBAL_LOG_COLORS: Final[dict[int, str]] = { 

31 Level.TRACE: "\033[37m", # white 

32 Level.DEBUG: "\033[36m", # cyan 

33 Level.INFO: "\033[32m", # green 

34 Level.WARNING: "\033[33m", # yellow 

35 Level.ERROR: "\033[31m", # red 

36 Level.CRITICAL: "\033[35m", # magenta 

37} 

38"""ANSI color codes used for console output when ``colorize=True``. 

39Keys are ``int(Level)`` values; values are ANSI escape sequences."""