SwiftyBeaver/SwiftyBeaver-Vapor

How to have a log instance globally?

agordeev opened this issue · 4 comments

It's quite clear from README how to access the log instance from Droplet. Is there a way to access it globally, from any file?

If you follow our setup example from the README then you will have in your app target the log constant available everywhere. For multiple targets you need multiple log constants.

I use Vapor 2, so README doesn't work right for me.

In Vapor 2 there're 2 targets: Run and App. All my code goes to App target. While I can set log instance for Run target in main.swift, it won't be accessible from App target. Any ideas how to workaround it?

please check this out. it is the temporary provider compatible with Vapor 2. We will add Vapor 2 support here, too in some days. https://github.com/vapor-community/swiftybeaver-provider

That's exactly what I'm using.