macro to place logger in the companion
See original GitHub issueHaving a val log
in every instance is extremely expensive… more so for lazy vals.
It would be much more efficient if the val lived on the companion and the log
were a def
that delegated.
To pull this off, one would have to implement this as a macro or compiler plugin.
Until then, I see no real benefit of using this library over say, akka’s Slf4jLogging
trait, which already exists on most classpaths.
Issue Analytics
- State:
- Created 9 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Macro to summon Mount + Companion - Wowhead
This is the macro I currently use to summon both mount and minipet: #showtooltip Fossilized Raptor /cast Fossilized Hatchling
Read more >Best practices for loggers - Kotlin Discussions
Hi, What are best practices for creating loggers? I've seen: val log = LoggingFactory.getLogger("com.example.app"); but it would be nice to do something ...
Read more >Basic debugging using logging for Swift and Objective-C apps.
This document talks about practical considerations about the NSLog function and the DEBUG preprocessor macro that are helpful for debugging.
Read more >Location Macro — a useful Scala macro - Medium
The Scala compiler evaluates locationMacro at compile time for each place Location.capture is called. It extracts the name of a class and a...
Read more >Meet KMO, a companion for your keyboard that acts as an ...
Meet KMO, a companion for your keyboard that acts as an input pass through and his own macro-pad! · There is a lot...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see. But that’s indeed out of scope, because Scala Logging will only use blackbox macros.
@fommil you don’t have to mix the
StrictLogging
(orLazyLogging
) trait into your classes. If you want, you can simply create aLogger
“manually” in a companion object and just use it from your companion classes.Nevertheless I don’t think that mixing
StrictLogging
(orLazyLogging
) into your classes creates too much overhead, because the logging framework will only create one logger instance per class name.