Source code for magscope._logging
"""Internal logging helpers for MagScope.
This module centralizes logging configuration so that the console
output can be silenced by default.
Only warnings and errors remain active unless :func:`configure_logging` is
invoked with ``verbose=True`` (or an explicit log level). The helper returns
``logging.Logger`` instances namespaced under ``"magscope"`` so that
submodules can log without manually wiring handlers.
"""
from __future__ import annotations
import logging
import sys
from typing import Optional
[docs]
_ROOT_LOGGER_NAME = "magscope"
[docs]
def get_logger(name: str) -> logging.Logger:
"""Return a child logger scoped under ``magscope``.
Parameters
----------
name:
Module or component name to suffix the root logger with.
"""
return logging.getLogger(f"{_ROOT_LOGGER_NAME}.{name}")