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

HighlightConverter does not honor {STYLE_NAME} configuration #1545

Closed
zartc opened this issue Jul 8, 2023 · 4 comments
Closed

HighlightConverter does not honor {STYLE_NAME} configuration #1545

zartc opened this issue Jul 8, 2023 · 4 comments
Labels
enhancement Additions or updates to features
Milestone

Comments

@zartc
Copy link

zartc commented Jul 8, 2023

Description

When using the HighlightConverter like this: %highlight{%5level}{LOGBACK} the HighlightConverter always uses the colors of the DEFAULT preset instead of the color of the LOGBACK as asked.

Configuration

Version: 2.20.0

Operating system: Windows 10

JDK: temirun-11

Logs

none

Reproduction

Configure a converter with: %highlight{%5level}{LOGBACK}
You will discover that the HighlightConverter always uses the colors of the DEFAULT preset.

Fixe

HighlightConverter.createLevelStyleMap() method is missing a check at line 151 to see if the passed options[1] contains a map of LEVEL=color or a preset style name.

if (!string.contains("=")) {
    return STYLES.getOrDefault(string, DEFAULT_STYLES);
}
@ppkarwasz
Copy link
Contributor

Hi @zartc,

As documented the correct syntax is:

%highlight{%5level}{STYLE=LOGBACK}

I wouldn't complexify the syntax to accept just "LOGBACK". There should be probably a warning if a user employs an incorrect syntax (without =). Could you submit a PR with the warning?

@ppkarwasz ppkarwasz added the enhancement Additions or updates to features label Jul 11, 2023
@awadammar
Copy link
Contributor

If @zartc doesn't mind, I can add the necessary warning message.

@ppkarwasz
Copy link
Contributor

@aawad6, go ahead!

@vy
Copy link
Member

vy commented Oct 5, 2023

@zartc, thanks so much for the report! 🙇 The issue is fixed. It will be available with the next release.

@vy vy closed this as completed Oct 5, 2023
vy added a commit that referenced this issue Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions or updates to features
Projects
None yet
Development

No branches or pull requests

4 participants