Skip to content

Commit

Permalink
WIP2
Browse files Browse the repository at this point in the history
  • Loading branch information
MoessnerFabian(Group) committed Jan 28, 2025
1 parent 48c03aa commit fb61ad6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
32 changes: 31 additions & 1 deletion logprep/util/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,34 @@ def get_ansi_code(color, type):
'lightwhite': 67
}

return f"\x1b[{str(base+colors.get(color))}m"
return f"\x1b[{str(base+colors.get(color))}m"


class AnsiFore:
_colors = {
'RED': 31,
'GREEN': 32,
'BLUE': 34,
'RESET': 39
}

def __class_getitem__(cls, name):
if name in cls._colors:
return f'\033[{cls._colors[name]}m'
raise AttributeError(f"No Ansi code found: {name}")


class AnsiBack:
_colors = {
'RED': 41,
'GREEN': 42,
'BLUE': 44,
'RESET': 49
}

def __class_getitem__(cls, name):
if name in cls._colors:
return f'\033[{cls._colors[name]}m'
raise AttributeError(f"No Ansi code found: {name}")


1 change: 1 addition & 0 deletions logprep/util/rule_dry_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from logprep.util.configuration import Configuration
from logprep.util.getter import GetterFactory
from logprep.util.helper import color_print_line, color_print_title, recursive_compare, get_ansi_code
from logprep.util.helper import AnsiBack, AnsiFore

yaml = YAML(typ="safe", pure=True)

Expand Down

0 comments on commit fb61ad6

Please sign in to comment.