import logging
import os

from dotenv import load_dotenv

# Load the environment variables
load_dotenv()

# Create the logger instance
logger: logging.Logger = logging.getLogger("loralogger")

# Set default_level
default_level = os.getenv("LORALOGGER_DEFAULT_LEVEL", "WARNING").upper()
logger.setLevel(default_level)

# Create handler to show log in the console
console_handler = logging.StreamHandler()

# set log format
formatter = logging.Formatter(fmt="{name} [{levelname}] :: {message}", style="{")
console_handler.setFormatter(formatter)

# add the formatter to the handler
logger.addHandler(console_handler)
