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
Extension method support for Microsoft.Extensions.Logging.ILogger? #23
Comments
Hi - thanks for the suggestion! No, support for MEL would be great in a separate library, but the plan for this one is to stay Serilog-specific. Cheers! |
@nblumhardt does such library exist? How should I properly use SerilogTimings with |
Hi @dropsonic - I'm not aware of anyone having published one, but I haven't searched carefully. As things stand, you need to use Serilog's logging interfaces with this library. |
https://github.com/serilog/serilog-extensions-logging might work for your use case @dropsonic @zolrath |
@zolrath Did you find a solution to this? |
@sveins12 What I found is this small package, says it is "This project is a port of Serilog Timings": |
@sveins12, @ivandamyanov I created a library that support for Microsoft.Extensions.Logging.ILogger couple years ago, and published to public (8 months ago). It is an adaptation of Serilog Timings. https://github.com/ogulcanturan/Ogu.Extensions.Logging.Timings |
Hi!
Great library I really appreciate the ease of timing blocks of code with a simple using!
I'm currently using .net core dependency injection and their ILogger interface with Serilog registered to it.
When I try to use the
_logger.TimeOperation("Processing {recordId}", id)
syntax I am greeted with:Cannot convert instance argument type 'Microsoft.Extensions.Logging.ILogger' to 'Serilog.ILogger'
or
Cannot convert instance argument type 'Microsoft.Extensions.Logging.ILogger<MyClassContext>' to 'Serilog.ILogger'
I am using the
Operation.Time
method at the moment but this loses the SourceContext that has been set up on my logger during injection.Any chance the extension methods could be enhanced to support the Microsoft ILogger?
Operation
and theCompletionBehavior
enum are internal so I cannot simply drop a new extension method in my project.Thanks!
The text was updated successfully, but these errors were encountered: