pain001.context package#
Application context package for pain001.
Submodules#
pain001.context.context module#
Singleton application context that owns the shared pain001 logger.
- class pain001.context.context.Context[source]#
Bases:
objectA singleton that manages the shared pain001 logger.
Instantiating the class directly raises RuntimeError once the singleton exists; use get_instance() instead.
Lifecycle overview (method details are documented below):
__init__initializes the class and creates a logger.get_instancereturns the singleton instance.get_loggerreturns the logger.init_loggerinitializes the logger.set_log_levelsets the logger’s level.set_namesets the logger’s name.
- static get_instance() Context[source]#
Returns the singleton instance of the class.
- Returns:
A Context instance.
- Raises:
RuntimeError – If the singleton failed to initialize (defensive check; unreachable in practice).
- init_logger() None[source]#
Initializes the logger.
- Raises:
RuntimeError – If the logger has already been initialized.