forked from clan/clan-core
Merge pull request 'Fixed duplicate logging issue with correct logging in ssh and in root logger' (#723) from Qubasa-main into main
This commit is contained in:
commit
969c79b426
@ -63,11 +63,18 @@ def get_caller() -> str:
|
|||||||
|
|
||||||
|
|
||||||
def setup_logging(level: Any) -> None:
|
def setup_logging(level: Any) -> None:
|
||||||
handler = logging.StreamHandler()
|
# Get the root logger and set its level
|
||||||
handler.setLevel(level)
|
main_logger = logging.getLogger("clan_cli")
|
||||||
handler.setFormatter(CustomFormatter())
|
main_logger.setLevel(level)
|
||||||
logger = logging.getLogger("registerHandler")
|
|
||||||
|
# Create and add the default handler
|
||||||
|
default_handler = logging.StreamHandler()
|
||||||
|
|
||||||
|
# Create and add your custom handler
|
||||||
|
default_handler.setLevel(level)
|
||||||
|
default_handler.setFormatter(CustomFormatter())
|
||||||
|
main_logger.addHandler(default_handler)
|
||||||
|
|
||||||
|
# Set logging level for other modules used by this module
|
||||||
logging.getLogger("asyncio").setLevel(logging.INFO)
|
logging.getLogger("asyncio").setLevel(logging.INFO)
|
||||||
logging.getLogger("httpx").setLevel(level=logging.WARNING)
|
logging.getLogger("httpx").setLevel(level=logging.WARNING)
|
||||||
logger.addHandler(handler)
|
|
||||||
# logging.basicConfig(level=level, handlers=[handler])
|
|
||||||
|
Loading…
Reference in New Issue
Block a user