-
Notifications
You must be signed in to change notification settings - Fork 19
Add direct log4cats integration
#286
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?
Conversation
c507c12 to
1ccb243
Compare
log4cats integrationlog4cats integration
| val callingMethodIndex = stacktraceElements.size - lastIndex | ||
| val callingMethod = stacktraceElements(callingMethodIndex) | ||
| val fileName = | ||
| (callingMethod.getClassName.replace('.', '/') + ".scala").split("\\/").takeRight(1).mkString |
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.
On JS it returns something like (<jscode>.scala:96229), not sure how to get a source file / line number.
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.
log4cats doesn't support sourcecode info, but it's a requirement for woof.
Perhaps, I could create a variant of Logger#doLog which doesn't require LogInfo to facilitate log4cats integration.
| override def isErrorEnabled: F[Boolean] = Applicative[F].pure(true) | ||
| override def isWarnEnabled: F[Boolean] = Applicative[F].pure(true) | ||
| override def isInfoEnabled: F[Boolean] = Applicative[F].pure(true) | ||
| override def isDebugEnabled: F[Boolean] = Applicative[F].pure(true) | ||
| override def isTraceEnabled: F[Boolean] = Applicative[F].pure(true) |
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.
Not sure if it's a problem, but log level filtering works.
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 have something similar in the slf4j-module:
woof/modules/slf4j-common/src/main/scala/org/legogroup/woof/slf4j/Slf4jWoofLoggerImpl.scala
Lines 94 to 100 in 713ace4
| private def testLevel(logLevel: LogLevel): Boolean = true | |
| def isDebugEnabled(): Boolean = testLevel(LogLevel.Debug) | |
| def isErrorEnabled(): Boolean = testLevel(LogLevel.Error) | |
| def isInfoEnabled(): Boolean = testLevel(LogLevel.Info) | |
| def isTraceEnabled(): Boolean = testLevel(LogLevel.Trace) | |
| def isWarnEnabled(): Boolean = testLevel(LogLevel.Warn) |
it should probably be reflected as a limitation in the docs
1ccb243 to
b39dfe2
Compare
b39dfe2 to
50265ab
Compare
|
Sorry, I missed this one in the scala steward noise. I'll give it a look next week when I'm back to work :) |
Direct
log4catsintegration withoutslf4jmiddleman.Allows using Woof with the new
http4s-1.xas it requiresLoggerFactory[F]forEmberClientBuilderandEmberServerBuilder.Works on JVM.
On JS test needs to be fixed - the
LogInfois a little wonky there.Couldn't run Native locally, apparently it hangs on linking.
Failed to run
mdoctoo.