Coverage for src/pyadql/config.py: 100%
7 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-23 22:58 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-07-23 22:58 +0000
1# skeleton-python-binary - Command-line tool that generates project templates based on predefined Python project template
2# Copyright (C) 2024-2025 - Centre National d'Etudes Spatiales
3# SPDX-License-Identifier: Apache-2.0
4# Auto-generated by skeleton-python-binary
5"""
6Module to configure global application logging using Loguru.
8This module provides a function to set up a global logger using the `loguru` library,
9allowing customization of log levels, output destinations, and formatting options.
10"""
12import sys
14from loguru import logger
17def configure_logging(
18 level="INFO",
19 sink=None,
20 colorize=True,
21 format="<green>{time:HH:mm:ss}</green> | <level>{level: <8}</level> | <level>{message}</level>",
22 **kwargs,
23):
24 """
25 Configure a global loguru logger.
27 """
28 # Use None + resolve sys.stderr here, so we always get the CURRENT
29 # sys.stderr (important for tests that capture/replace stderr).
30 if sink is None:
31 sink = sys.stderr
32 logger.remove()
33 logger.add(
34 sys.stderr, level=level.upper(), colorize=colorize, format=format, **kwargs
35 )