Comments (5)
The purpose behind this is to support original types being able to be received by the logging system. For example, if I'm writing a database logger and want to provide a structured logging of specific types I can do so in Scribe. For most people, they always just pass Strings, and in your case, you can use:
import scribe.LogRecord.Stringify._
That will give you implicit conversion support for Throwable
. I need to write an update to auto-handle that though.
I appreciate the feedback, and it's a rather new feature that still needs to be iterated upon, but the goal is the capacity to access more than just a String
when desired for more complex logging.
from scribe.
Thanks for the explanation. For me, this sounds like a typeclass would be more suited for this, because I find implicit views kind of dangerous to use. If you have them in scope, you can have funny type conversion just by accident. What do you think?
So defining a Loggable
for e.g. Throwable
would be much more explicit:
object Loggable {
implicit object ThrowableLoggable extends Loggable[Throwable] {
def logString(t: Throwable) = t.getMessage // or whatever
}
}
So this would even work without an additional import.
from scribe.
Interested in putting together a PR to represent this? I'm not opposed to the idea, but I'm worried there might be integration issues.
from scribe.
PR merged, closing.
from scribe.
Released 2.3.2 with these changes
from scribe.
Related Issues (20)
- Log4JMigrationjava NoSuchElementException: Add a default value for EventCounter HOT 8
- Scala JS source maps, map to release dir? HOT 9
- No colours when run on Node.js HOT 14
- TASTy file was produced by Scala 3.2.0 HOT 7
- [Suggestion] improve JSON logging usability HOT 5
- REPL: scribe macro NPE when the scala source file is virtual HOT 2
- Include ISO8601 datetime formatters in core HOT 7
- Logstash encoding for stdout HOT 2
- Exceptions are not logged by SLF4JHelper since 3.9.0 HOT 5
- Unable to have minimumLevel=Info and only enable Trace for certain packages HOT 11
- Overriding the path for log files HOT 4
- Help: configure stdout/stderr in function of LogLevel HOT 15
- Compare perfomance with Chronicle-Logger HOT 2
- NPE when logging with SLF4J and Throwble == null HOT 4
- Different versions of scala-collection-compat pulled in transitively HOT 3
- Logger ignores `data` field HOT 3
- AsynchronousLogHandle shutdown hook HOT 3
- MDC syntax improvement HOT 7
- Standardize JSON output ? HOT 3
- Is it safe to use MDC with cats-effect? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.