Skip to content

Commit

Permalink
Added single highlight from args
Browse files Browse the repository at this point in the history
  • Loading branch information
geirawsm committed May 9, 2024
1 parent 3479546 commit 245ea12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions sausage_bot/util/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
action='store',
default=None,
dest='log_highlight')
logging_args.add_argument('--highlight-color', '-hlc',
help='Chose color to Highlight',
action='store',
default='red',
dest='log_highlight_color')
logging_args.add_argument('--log-all',
help='Log all levels (log, verbose, log-print, '
'log-database and debug)',
Expand Down
9 changes: 6 additions & 3 deletions sausage_bot/util/log/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ def log_function(
extra_color = eval('Fore.{}'.format(extra_color.upper()))
function_name = log_func_name()
if args.log_print:
if args.log_highlight is not None and str(args.log_highlight)\
in function_name['name']:
color = Fore.RED
if args.log_highlight is not None:
if str(args.log_highlight) in function_name['name'] or\
str(args.log_highlight) in log_in:
color = eval('Fore.{}'.format(
args.log_highlight_color.upper()
))
dt = pendulum.now(config.TIMEZONE)
_dt_full = dt.format('DD.MM.YYYY HH.mm.ss')
if args.log_print:
Expand Down

0 comments on commit 245ea12

Please sign in to comment.