charmbracelet / charmbracelet/log

Consider changing the `MaxWidth` in `DefaultStyles` from 4 to 5

Open Beginner friendly
#164 0 comments 8 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
3.4k
Forks
103
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I wouldn't say a problem, just a minor gripe I have to workaround by setting my own style :)

The logger that `log.New` creates imposes a maximum width on the level string of 4 which means `ERROR` and `DEBUG` get cut off to `ERRO` and `DEBU` which I think looks a bit odd?

Personally I tend to define a new `Style` that is an exact copy of the default styles (defined [here](https://github.com/charmbracelet/log/blob/e75da3a0c9bcf01ba25d9326f9141d7d642784a9/styles.go#L43-L82)) with `MaxWidth` changed from 4 to 5.

**Describe the solution you'd like**
I'd like for `DefaultStyles` to return styles with a max width of 5

**Describe alternatives you've considered**
Continue my workaround which is fine I guess, just a lot of code for a single change. The rest of the default styles is perfect as is!

**Additional context**
I'm very happy to do the PR if this change is desired 👍🏻

Contributor guide

Open the contributing guide

Research direction

Start with the DefaultStyles definition in styles.go, linked in the issue, and inspect how its MaxWidth setting affects the level string produced by log.New. Done means the default style allows five-character levels such as ERROR and DEBUG without truncation; verify the resulting logger output and any nearby existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.