Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Generalize a little.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenroller committed Aug 29, 2020
1 parent 18bfd46 commit 6b4074b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parlai/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}


def _is_color_friendly():
def _is_interactive():
try:
__IPYTHON__
return True
Expand Down Expand Up @@ -79,14 +79,14 @@ def __init__(

def _build_formatter(self):
prefix_format = f'{self.prefix} ' if self.prefix else ''
if COLORED_LOGS and sys.stdout.isatty():
if COLORED_LOGS and _is_interactive():
return coloredlogs.ColoredFormatter(
prefix_format + COLORED_FORMAT,
datefmt=CONSOLE_DATE_FORMAT,
level_styles=COLORED_LEVEL_STYLES,
field_styles={},
)
elif sys.stdout.isatty():
elif _is_interactive():
return logging.Formatter(
prefix_format + CONSOLE_FORMAT, datefmt=CONSOLE_DATE_FORMAT,
)
Expand Down

0 comments on commit 6b4074b

Please sign in to comment.