chessai.core.log

 1import argparse
 2import typing
 3
 4import edq.core.log
 5
 6WARN_LOGGERS: typing.List[str] = [
 7    "PIL",
 8]
 9""" Loggers (usually third-party) to move up to warning on init. """
10
11def set_cli_args(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
12    """
13    Set common CLI arguments.
14    This is a sibling to init_from_args(), as the arguments set here can be interpreted there.
15    """
16
17    edq.core.log.set_cli_args(parser, {})
18    return parser
19
20def init_from_args(parser: argparse.ArgumentParser, args: argparse.Namespace) -> argparse.Namespace:
21    """
22    Take in args from a parser that was passed to set_cli_args(),
23    and call init() with the appropriate arguments.
24    """
25
26    edq.core.log.init_from_args(parser, args, {})
27    return args
28
29# Load the default logging when this module is loaded.
30edq.core.log.init(warn_loggers = WARN_LOGGERS)
WARN_LOGGERS: List[str] = ['PIL']

Loggers (usually third-party) to move up to warning on init.

def set_cli_args(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
12def set_cli_args(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
13    """
14    Set common CLI arguments.
15    This is a sibling to init_from_args(), as the arguments set here can be interpreted there.
16    """
17
18    edq.core.log.set_cli_args(parser, {})
19    return parser

Set common CLI arguments. This is a sibling to init_from_args(), as the arguments set here can be interpreted there.

def init_from_args( parser: argparse.ArgumentParser, args: argparse.Namespace) -> argparse.Namespace:
21def init_from_args(parser: argparse.ArgumentParser, args: argparse.Namespace) -> argparse.Namespace:
22    """
23    Take in args from a parser that was passed to set_cli_args(),
24    and call init() with the appropriate arguments.
25    """
26
27    edq.core.log.init_from_args(parser, args, {})
28    return args

Take in args from a parser that was passed to set_cli_args(), and call init() with the appropriate arguments.