Skip to content

Commit

Permalink
Merge branch 'chris.thuyen/fix/make_colorlog_optional' into 'master'
Browse files Browse the repository at this point in the history
chore(*): make `colorlog` import as optional

See merge request mobile/dax-ios/cocoapods-binary-cache!11
  • Loading branch information
christhuyenatgrab committed Apr 15, 2020
2 parents 8d47140 + 8217e68 commit f159cbf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/command/PythonScripts/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import os
import logging
import colorlog


def setup_logger():
Expand All @@ -12,8 +11,14 @@ def setup_logger():
format_str = '[%(asctime)s] [%(levelname)s] %(message)s'
date_format = '%H:%M:%S'

try:
import colorlog

This comment has been minimized.

Copy link
@qalandarov

qalandarov Apr 15, 2020

Wouldn't the CI fail if it doesn't have this installed? 🤔
Never mind, it would just treat as not available 👍

is_colorlog_installed = True
except: # noqa: E722
is_colorlog_installed = False

# Enable colorlog if you run from terminal or on CI environment
if os.isatty(2) or os.environ.get('CI'):
if is_colorlog_installed and (os.isatty(2) or os.environ.get('CI')):
cformat = '%(log_color)s' + format_str
colors = {
'DEBUG': 'white',
Expand Down

0 comments on commit f159cbf

Please sign in to comment.