Skip to content

Commit

Permalink
use bright color style for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed Apr 6, 2020
1 parent 5731ade commit 510ab86
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions ansibledoctor/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import ansibledoctor.Exception

CONSOLE_FORMAT = "{}[%(levelname)s]{} %(message)s"
CONSOLE_FORMAT = "{}{}[%(levelname)s]{} %(message)s"
JSON_FORMAT = "(asctime) (levelname) (message)"


Expand Down Expand Up @@ -94,7 +94,11 @@ def _get_error_handler(self, json=False):
handler.addFilter(LogFilter(logging.ERROR))
handler.setFormatter(
MultilineFormatter(
self.error(CONSOLE_FORMAT.format(colorama.Fore.RED, colorama.Style.RESET_ALL))
self.error(
CONSOLE_FORMAT.format(
colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
)
)
)
)

Expand All @@ -109,7 +113,11 @@ def _get_warn_handler(self, json=False):
handler.addFilter(LogFilter(logging.WARN))
handler.setFormatter(
MultilineFormatter(
self.warn(CONSOLE_FORMAT.format(colorama.Fore.YELLOW, colorama.Style.RESET_ALL))
self.warn(
CONSOLE_FORMAT.format(
colorama.Fore.YELLOW, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
)
)
)
)

Expand All @@ -124,7 +132,11 @@ def _get_info_handler(self, json=False):
handler.addFilter(LogFilter(logging.INFO))
handler.setFormatter(
MultilineFormatter(
self.info(CONSOLE_FORMAT.format(colorama.Fore.CYAN, colorama.Style.RESET_ALL))
self.info(
CONSOLE_FORMAT.format(
colorama.Fore.CYAN, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
)
)
)
)

Expand All @@ -139,7 +151,11 @@ def _get_critical_handler(self, json=False):
handler.addFilter(LogFilter(logging.CRITICAL))
handler.setFormatter(
MultilineFormatter(
self.critical(CONSOLE_FORMAT.format(colorama.Fore.RED, colorama.Style.RESET_ALL))
self.critical(
CONSOLE_FORMAT.format(
colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
)
)
)
)

Expand All @@ -154,7 +170,11 @@ def _get_debug_handler(self, json=False):
handler.addFilter(LogFilter(logging.DEBUG))
handler.setFormatter(
MultilineFormatter(
self.critical(CONSOLE_FORMAT.format(colorama.Fore.BLUE, colorama.Style.RESET_ALL))
self.critical(
CONSOLE_FORMAT.format(
colorama.Fore.BLUE, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
)
)
)
)

Expand Down

0 comments on commit 510ab86

Please sign in to comment.