Improved readme.

This commit is contained in:
Andrew Lalis 2023-03-02 11:22:29 +01:00
parent 872db843f0
commit ee6e915f4d
1 changed files with 28 additions and 2 deletions

View File

@ -1,2 +1,28 @@
# slf4d-dlog
DLog provider implementation for SLF4D
# SLF4D-DLog
An [SLF4D](https://code.dlang.org/packages/slf4d) provider for the [DLog](https://code.dlang.org/packages/dlog) logging library.
## Getting Started
The following snippet shows all that's needed to start logging with the DLog provider for SLF4D:
```d
import slf4d;
import slf4d_dlog;
auto dlogProvider = new shared DLogProvider();
configureLoggingProvider(dlogProvider);
auto log = getLogger();
log.info("This message will be handled by DLog.");
```
You can customize DLog's behavior by providing a custom `Logger` or `MessageTransform` when constructing the DLogProvider:
```d
auto customizedProvider = new shared DLogProvider(myCustomLogger);
auto otherProvider = new shared DLogProvider(myCustomMessageTransform);
```
### Thread-Safety
Because DLog is designed for single-threaded use only, this provider synchronizes access to the underlying DLog logger such that only one thread may access it at a time.