-
Notifications
You must be signed in to change notification settings - Fork 82
Add a ConsoleLogger and ConsoleLoggerFactory #912
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
base: main
Are you sure you want to change the base?
Add a ConsoleLogger and ConsoleLoggerFactory #912
Conversation
core/shared/src/main/scala/org/typelevel/log4cats/extras/ConsoleLogger.scala
Outdated
Show resolved
Hide resolved
core/shared/src/main/scala/org/typelevel/log4cats/extras/ConsoleLogger.scala
Outdated
Show resolved
Hide resolved
* limitations under the License. | ||
*/ | ||
|
||
package org.typelevel.log4cats.extras |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the dedicated js-console
module that exposes ConsoleLogger
for JS. Shouldn't we either create a new module for JVM/Native to maintain consistency (perhaps extras
would be fine), or at the very least move the new ConsoleLogger
to a JVM/Native-specific submodule, so it's only published for the mentioned platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really have the setup, but I'm kind of curious what this would do in JS. I'd assume that Console
has an implementation on that platform 🤔
It's all going on stderr, so I'd be open to renaming it StdErrLogger
to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought part of the goal was to have this available in core, without depending on other modules? Otherwise, I'd think we'd just use slf4j and slf4j-simple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a core motivation - make it dead simple to use out-of-the-box, and avoid requiring users who don't need heavy configuration (like scastie examples or scripts) to remember the artifact coordinates for the stuff to make slf4j-simple
work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danicheg following up on if the rename to StdErrLogger
works for you as a disambiguation with the JS ConsoleLogger
Implements #911
If there's interest, I'll figure out how to add some tests to this.