Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plain2code_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

LOGGER_NAME = "codeplain"

# Attach a NullHandler so that log records emitted before setup_logging() configures
# the real handlers (e.g. during --dry-run, --status, --full-plain, or early parse
# errors) are not printed to stderr by logging.lastResort. Without this, console.error()
# / console.warning() — which both log the message and print it via rich — would show the
# same message twice: once in plain text (from lastResort) and once styled (from rich).
logging.getLogger(LOGGER_NAME).addHandler(logging.NullHandler())


class IndentedFormatter(logging.Formatter):
def format(self, record):
Expand Down
Loading