-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Labels
Description
If the provider is using the static Log
pipeline, the application should be responsible for disposal as there's no indication of any ownership transfer.
If a disposable Logger
instance is passed in, disposing it is reasonable. To make this explicit, we could:
- overload
AddSerilog()
with a method specifically acceptingLogger
- or, make the overload generic
where TLogger: ILogger, IDisposable
- or, add a
dispose:
default Boolean parameter toAddSerilog()
- or, add a new method like
AddSerilogAndDispose()
for the purpose.
The decision here depends on whether we want to move towards disposing by default (1 or 2) or not (3 or 4).
If we want to dispose by default, (1) is probably the friendliest option, while (3) seems like the tidiest opt-in mechanism.