Skip to content

Is it possible to add Color logs only for some handlers #80

Description

@pymen

Is it possible to add Color logs only for some handlers, like console, and exclude for others like file,

or can you provide Formatter that will clean logs correctly

image

class FileOutputFormatter(logging.Formatter):
def format(self, record):
msg = super().format(record)
color_prefix = "\0%s["
color_suffix = '\0[0m'
colors = range(30, 42)
for color in colors:
msg = msg.replace(color_prefix % color, "").replace(color_suffix % color, "")

    return msg

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions