Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for colorized output #18

Merged
merged 2 commits into from
Nov 15, 2022
Merged

Support for colorized output #18

merged 2 commits into from
Nov 15, 2022

Conversation

solnic
Copy link
Member

@solnic solnic commented Nov 15, 2022

This restores colorize: true option and introduces support for color tags in string templates.

Supported colors:

COLORS = {
  black: 30,
  red: 31,
  green: 32,
  yellow: 33,
  blue: 34,
  magenta: 35,
  cyan: 36,
  gray: 37
}.freeze

Here are a couple of usage examples:

# to enable coloring of severity
logger = Dry.Logger(:test, colorize: true)

# to enable customize severity colors
logger = Dry.Logger(:test, colorize: true, severity_colors: {info: :blue})

# to use colors in templates
logger = Dry.Logger(:test, template: "<green>%<message>s</green>")

@solnic solnic marked this pull request as ready for review November 15, 2022 06:54
@solnic solnic changed the title Colorized templates Support for colorized ouput Nov 15, 2022
@solnic solnic changed the title Support for colorized ouput Support for colorized output Nov 15, 2022
@solnic solnic merged commit 103050c into main Nov 15, 2022
@solnic solnic deleted the colorized-templates branch November 15, 2022 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant