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

Custom logger #46

Open
LMnet opened this issue Dec 3, 2015 · 4 comments
Open

Custom logger #46

LMnet opened this issue Dec 3, 2015 · 4 comments

Comments

@LMnet
Copy link

LMnet commented Dec 3, 2015

In my project I want to have custom logger, based on scala-logging Logger class. But for now there is no possibility to create custom logger. Logger class is final and with private construstor.
I have tried some experiments in fork, but macroses makes all inheritance stuff very complicated.

@analytically
Copy link
Collaborator

Can you explain your use case for a custom logger?

@LMnet
Copy link
Author

LMnet commented Apr 16, 2016

In my project in some classes I need to wrap all logger calls with MDC.put and MDC.remove calls. It would be cool if I will have a possibility to add this boilerplate calls inside custom logger.

@zatekusen
Copy link

We have a similar situation in our project. We have a custom ThrottledLogger extends Logger - the old trait which is available in version 2.1.2.
All classes use that trait and we can choose to supply normal or throttled logger.

Now that trait has gone in the latest version, there is no common trait to use unless we hand crank our own version.

@analytically
Copy link
Collaborator

Via Patrick Premont: I think this wouldn’t help those who want to override the macros. They would need to ensure their subclass is used explicitly everywhere. Any reference to the base class would not get the overridden behaviour. So it would be safer for their type not to extend Logger, to avoid such accidents. I created a gist to highlight the compile-time dispatch that occurs with the macro override: https://gist.github.com/patrick-premont/01c5847958e1776d7748bb9570ee376e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants