I've been spending some time in the last few weeks to prototype a logging framework that's inspired by SLF4J. To that end, I've created SLF4D, which provides a common logging interface, and a pluggable architecture to allow third-parties to handle log messages generated by any logger in an application.
Here's a short example of how it can be used in your code:
import slf4d;
void main() {
auto log = getLogger();
log.info("This is an info message.");
log.errorF!"This is an error message: %d"(42);
}
The library includes a default "logging provider" that just outputs formatted messages to stdout and stderr, but a third-party provider can be used by calling configureLoggingProvider(provider)
.
The idea is that I can create logging providers to wrap the various logging facilities available in the D ecosystem already (Phobos, Vibe-D, etc.), so SLF4D can serve as a common interface to any provider.
I'd appreciate any feedback on this so far! This first version should be mostly stable, but there may of course be bugs. Thanks!