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

Add WithSeverity #14

Merged
merged 2 commits into from
Feb 1, 2022
Merged

Add WithSeverity #14

merged 2 commits into from
Feb 1, 2022

Conversation

michaelpj
Copy link
Collaborator

Fixes #13.

Couple of questions:

  • I've given it a derived Show instance, rather than, say, something like [DEBUG] <msg>. I think it's probably better not to get opinionated about formatting and just have a boring Show.
  • I don't know how you like to name record selectors. I think it's useful to have the selector for severity, as you can see in the example! But I'm happy to call it something else.

I took the liberty of adding a couple of deriving extensions to default-extensions since it looked like you had put others there. But happy to just put them in the file.

@michaelpj
Copy link
Collaborator Author

On reflection I should probably add mapSeverity :: (Severity -> Severity) -> WithSeverity msg -> WithSeverity msg in order to do things like this:

suppressErrors :: LogAction m (WithSeverity msg) -> LogAction m (WithSeverity msg)
suppressErrors = cmap (mapSeverity (\s -> if s == Error then Warning else s))

Copy link
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

@michaelpj The changes look great! 💯

Feel free to add the mapSeverity function as well 🙂
It looks useful 👍🏻

@chshersh chshersh mentioned this pull request Feb 1, 2022
@michaelpj
Copy link
Collaborator Author

Added mapSeverity, so I think this is good to go!

Copy link
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏻

@chshersh chshersh merged commit 77a01a4 into co-log:main Feb 1, 2022
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.

WithSeverity
2 participants