Skip to content

Commit

Permalink
⚡ Update(constants) ansi colors & format options
Browse files Browse the repository at this point in the history
  • Loading branch information
MEHRSHAD-MIRSHEKARY committed Oct 4, 2024
1 parent 7df78d6 commit 6367c51
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 13 deletions.
19 changes: 19 additions & 0 deletions django_logging/constants/ansi_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class AnsiColors:
BRIGHT_MAGENTA: str = "\033[0;95m"
BRIGHT_CYAN: str = "\033[0;96m"
BRIGHT_WHITE: str = "\033[0;97m"
PINK: str = "\033[38;5;213m"
LIGHT_PURPLE = "\033[38;5;129m"
BLACK_BACKGROUND: str = "\033[40m"
RED_BACKGROUND: str = "\033[41m"
GREEN_BACKGROUND: str = "\033[42m"
Expand All @@ -30,6 +32,23 @@ class AnsiColors:
MAGENTA_BACKGROUND: str = "\033[45m"
CYAN_BACKGROUND: str = "\033[46m"
WHITE_BACKGROUND: str = "\033[47m"
BRIGHT_BLACK_BACKGROUND: str = "\033[100m"
BRIGHT_RED_BACKGROUND: str = "\033[101m"
BRIGHT_GREEN_BACKGROUND: str = "\033[102m"
BRIGHT_YELLOW_BACKGROUND: str = "\033[103m"
BRIGHT_BLUE_BACKGROUND: str = "\033[104m"
BRIGHT_MAGENTA_BACKGROUND: str = "\033[105m"
BRIGHT_CYAN_BACKGROUND: str = "\033[106m"
BRIGHT_WHITE_BACKGROUND: str = "\033[107m"

BOLD: str = "\033[1m"
DIM: str = "\033[2m"
ITALIC: str = "\033[3m"
BOLD_ITALIC: str = "\033[1;3m"
UNDERLINE: str = "\033[4m"
BLINK: str = "\033[5m"
INVERT: str = "\033[7m"
STRIKETHROUGH: str = "\033[9m"


# Mapping log levels to ANSI colors
Expand Down
33 changes: 20 additions & 13 deletions django_logging/constants/log_format_options.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FORMAT_OPTIONS = {
1: "%(levelname)s | %(asctime)s | %(module)s | %(message)s",
2: "%(levelname)s | %(asctime)s | %(message)s",
3: "%(levelname)s | %(message)s",
4: "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
5: "%(levelname)s | %(message)s | [in %(pathname)s:%(lineno)d]",
6: "%(asctime)s | %(levelname)s | %(message)s",
7: "%(levelname)s | %(asctime)s | in %(module)s: %(message)s",
8: "%(levelname)s | %(message)s | [%(filename)s:%(lineno)d]",
9: "[%(asctime)s] | %(levelname)s | in %(module)s: %(message)s",
10: "%(asctime)s | %(processName)s | %(name)s | %(levelname)s | %(message)s",
11: "%(asctime)s | %(threadName)s | %(name)s | %(levelname)s | %(message)s",
12: "%(levelname)s | [%(asctime)s] | (%(filename)s:%(lineno)d) | %(message)s",
13: "%(levelname)s | [%(asctime)s] | {%(name)s} | (%(filename)s:%(lineno)d): %(message)s",
1: "%(levelname)s | %(asctime)s | %(module)s | %(message)s | %(context)s",
2: "%(levelname)s | %(asctime)s | %(context)s | %(message)s",
3: "%(levelname)s | %(context)s | %(message)s",
4: "%(context)s | %(asctime)s - %(name)s - %(levelname)s - %(message)s",
5: "%(levelname)s | %(message)s | %(context)s | [in %(pathname)s:%(lineno)d]",
6: "%(asctime)s | %(context)s | %(levelname)s | %(message)s",
7: "%(levelname)s | %(asctime)s | %(context)s | in %(module)s: %(message)s",
8: "%(levelname)s | %(context)s | %(message)s | [%(filename)s:%(lineno)d]",
9: "[%(asctime)s] | %(levelname)s | %(context)s | in %(module)s: %(message)s",
10: "%(asctime)s | %(processName)s | %(context)s | %(name)s | %(levelname)s | %(message)s",
11: "%(asctime)s | %(context)s | %(threadName)s | %(name)s | %(levelname)s | %(message)s",
12: "%(levelname)s | [%(asctime)s] | %(context)s | (%(filename)s:%(lineno)d) | %(message)s",
13: "%(levelname)s | [%(asctime)s] | %(context)s | {%(name)s} | (%(filename)s:%(lineno)d): %(message)s",
14: "[%(asctime)s] | %(levelname)s | %(context)s | %(name)s | %(module)s | %(message)s",
15: "%(levelname)s | %(context)s | %(asctime)s | %(filename)s:%(lineno)d | %(message)s",
16: "%(levelname)s | %(context)s | %(message)s | [%(asctime)s] | %(module)s",
17: "%(levelname)s | %(context)s | [%(asctime)s] | %(process)d | %(message)s",
18: "%(levelname)s | %(context)s | %(asctime)s | %(name)s | %(message)s",
19: "%(levelname)s | %(asctime)s | %(context)s | %(module)s:%(lineno)d | %(message)s",
20: "[%(asctime)s] | %(levelname)s | %(context)s | %(thread)d | %(message)s",
}

0 comments on commit 6367c51

Please sign in to comment.