forked from github/pelican
Move rich's console to log.py
This commit is contained in:
parent
7d492bad67
commit
a52922bfb5
3 changed files with 8 additions and 10 deletions
|
|
@ -13,11 +13,9 @@ from collections.abc import Iterable
|
|||
from pkgutil import extend_path
|
||||
__path__ = extend_path(__path__, __name__)
|
||||
|
||||
from rich.console import Console
|
||||
from rich.logging import RichHandler
|
||||
|
||||
# pelican.log has to be the first pelican module to be loaded
|
||||
# because logging.setLoggerClass has to be called before logging.getLogger
|
||||
from pelican.log import console
|
||||
from pelican.log import init as init_logging
|
||||
from pelican.generators import (ArticlesGenerator, # noqa: I100
|
||||
PagesGenerator, SourceFileGenerator,
|
||||
|
|
@ -38,7 +36,6 @@ except Exception:
|
|||
|
||||
DEFAULT_CONFIG_NAME = 'pelicanconf.py'
|
||||
logger = logging.getLogger(__name__)
|
||||
console = Console()
|
||||
|
||||
|
||||
class Pelican:
|
||||
|
|
@ -502,8 +499,7 @@ def main(argv=None):
|
|||
args = parse_arguments(argv)
|
||||
logs_dedup_min_level = getattr(logging, args.logs_dedup_min_level)
|
||||
init_logging(level=args.verbosity, fatal=args.fatal,
|
||||
handler=RichHandler(console=console), name=__name__,
|
||||
logs_dedup_min_level=logs_dedup_min_level)
|
||||
name=__name__, logs_dedup_min_level=logs_dedup_min_level)
|
||||
|
||||
logger.debug('Pelican version: %s', __version__)
|
||||
logger.debug('Python version: %s', sys.version.split()[0])
|
||||
|
|
@ -544,5 +540,4 @@ def main(argv=None):
|
|||
|
||||
if args.verbosity == logging.DEBUG:
|
||||
console.print_exception()
|
||||
else:
|
||||
sys.exit(getattr(e, 'exitcode', 1))
|
||||
sys.exit(getattr(e, 'exitcode', 1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue