-
Notifications
You must be signed in to change notification settings - Fork 245
No Overload for Exception, error format and args. #294
Comments
I think the main reason would be already crowded intellisense for these extension methods. Would using ILogValues and have an entry for the Exception work? It doesn't seem ideal but should be doable. Of course you can add your own extension methods, just follow https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Abstractions/LoggerExtensions.cs |
I've just seen that I posted the same question in the discussion about the recent API changes: #350 It appears to be a very useful overload so I think this would be a great addition! |
I could write a PR for this if you want this in the library. I'm sure there will be many more questions about this because many people won't use Event-Ids in their code. I don't agree that this makes the API noisy - i think it's the opposite, it makes it clear that event-ids are optional. |
Seems odd to not have a logger that lets you easily write an exception message (using a format string) and pass the Exception in.... so I would use it if its included. When I added this back in November I thought the code was close to being released so didn't want to add the overload but it seems they are farther from RC now then they were then... |
@muratg it is a common use-case to log exceptions, why make users add the magic constant ('0') or define their own extension methods? |
Here I am a year later and actually using these Extensions. What sucks is now they make you specify an EventId object anytime you want to include an Exception. |
Added the overloads myself in a pull request. Yay open source. |
There are quite a few overloads but there aren't any that accept the Exception along with an error format string and args. This seems to be how I most often want to use it. Is there any reason not to add an overload for that?
The text was updated successfully, but these errors were encountered: