diff --git a/jrnl/cli.py b/jrnl/cli.py index 7c692c4f9..d8009df63 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -5,6 +5,8 @@ import sys import traceback +from rich.logging import RichHandler + from jrnl.args import parse_args from jrnl.exception import JrnlException from jrnl.jrnl import run @@ -21,7 +23,9 @@ def configure_logger(debug=False): logging.basicConfig( level=logging.DEBUG, - format="%(levelname)-8s %(name)-12s %(message)s", + datefmt="[%X]", + format="%(message)s", + handlers=[RichHandler()], ) logging.getLogger("parsedatetime").setLevel(logging.INFO) logging.getLogger("keyring.backend").setLevel(logging.ERROR) @@ -34,7 +38,7 @@ def cli(manual_args=None): args = parse_args(manual_args) configure_logger(args.debug) - logging.debug("Parsed args: %s", args) + logging.debug("Parsed args:\n%s", args) status_code = run(args) diff --git a/jrnl/config.py b/jrnl/config.py index 8e5c5a143..e3290d8b7 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -8,6 +8,7 @@ import colorama import xdg.BaseDirectory +from rich.pretty import pretty_repr from ruamel.yaml import YAML from ruamel.yaml import constructor @@ -126,12 +127,15 @@ def scope_config(config, journal_name): if type(journal_conf) is dict: # We can override the default config on a by-journal basis logging.debug( - "Updating configuration with specific journal overrides %s", journal_conf + "Updating configuration with specific journal overrides:\n%s", + pretty_repr(journal_conf), ) config.update(journal_conf) else: # But also just give them a string to point to the journal file config["journal"] = journal_conf + + logging.debug("Scoped config:\n%s", pretty_repr(config)) return config diff --git a/jrnl/install.py b/jrnl/install.py index b20685f06..be0c7bc3b 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -6,6 +6,8 @@ import os import sys +from rich.pretty import pretty_repr + from jrnl.config import DEFAULT_JOURNAL_KEY from jrnl.config import get_config_path from jrnl.config import get_default_config @@ -101,7 +103,7 @@ def load_or_install_jrnl(alt_config_path): logging.debug("Configuration file not found, installing jrnl...") config = install() - logging.debug('Using configuration "%s"', config) + logging.debug('Using configuration:\n"%s"', pretty_repr(config)) return config