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

feat: allow to set styles in options #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

op
Copy link
Contributor

@op op commented Jun 19, 2024

This allow you to set styles directly from options instead of calling SetStyles.

@op op requested a review from aymanbagabas as a code owner June 19, 2024 17:39
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.63%. Comparing base (2338a13) to head (e9ca10a).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #133      +/-   ##
==========================================
+ Coverage   80.92%   82.63%   +1.71%     
==========================================
  Files          11       11              
  Lines         739      714      -25     
==========================================
- Hits          598      590       -8     
+ Misses        126      108      -18     
- Partials       15       16       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -66,7 +66,7 @@ func NewWithOptions(w io.Writer, o Options) *Logger {

l.SetOutput(w)
l.SetLevel(Level(l.level))
l.SetStyles(DefaultStyles())
l.SetStyles(o.Styles)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
l.SetStyles(o.Styles)
styles := o.Styles
if styles == nil {
styles = DefaultStyles()
}
l.SetStyles(styles)

Copy link
Member

@aymanbagabas aymanbagabas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case?

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.

2 participants