add log_level param to create_node, add name to logger

This commit is contained in:
cloudwithax 2023-03-12 22:36:36 -04:00
parent 52a45afd70
commit a7da475c0c
1 changed files with 3 additions and 1 deletions

View File

@ -209,7 +209,7 @@ class Node:
return self.latency return self.latency
def _setup_logging(self, level: LogLevel) -> logging.Logger: def _setup_logging(self, level: LogLevel) -> logging.Logger:
logger = logging.getLogger() logger = logging.getLogger("pomice")
handler = logging.StreamHandler() handler = logging.StreamHandler()
dt_fmt = "%Y-%m-%d %H:%M:%S" dt_fmt = "%Y-%m-%d %H:%M:%S"
formatter = logging.Formatter( formatter = logging.Formatter(
@ -874,6 +874,7 @@ class NodePool:
session: Optional[aiohttp.ClientSession] = None, session: Optional[aiohttp.ClientSession] = None,
apple_music: bool = False, apple_music: bool = False,
fallback: bool = False, fallback: bool = False,
log_level: LogLevel = LogLevel.INFO,
) -> Node: ) -> Node:
"""Creates a Node object to be then added into the node pool. """Creates a Node object to be then added into the node pool.
For Spotify searching capabilites, pass in valid Spotify API credentials. For Spotify searching capabilites, pass in valid Spotify API credentials.
@ -898,6 +899,7 @@ class NodePool:
spotify_client_secret=spotify_client_secret, spotify_client_secret=spotify_client_secret,
apple_music=apple_music, apple_music=apple_music,
fallback=fallback, fallback=fallback,
log_level=log_level,
) )
await node.connect() await node.connect()