# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2025 unelected
#
# This file is part of the zafiaonline project.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

"""
Logging configuration for the Mafia Online client.

Initializes and configures the global logger used throughout the
Mafia Online client library. The logger outputs messages to stdout
using a standard timestamped format.

Typical usage example:

    from zafiaonline.logger import logger

    logger.info("Application started")
    logger.error("An error occurred")
"""
import logging
import sys


logger: logging.Logger = logging.getLogger("zafiaonline")
logger.setLevel(logging.INFO)
logger.propagate = False

if not logger.handlers:
    handler: logging.StreamHandler = logging.StreamHandler(sys.stdout)
    formatter: logging.Formatter = logging.Formatter(
        "%(asctime)s - %(levelname)s - %(message)s"
    )
    handler.setFormatter(formatter)
    logger.addHandler(handler)
