Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

No Overload for Exception, error format and args. #294

Closed
runxc1 opened this issue Nov 16, 2015 · 8 comments
Closed

No Overload for Exception, error format and args. #294

runxc1 opened this issue Nov 16, 2015 · 8 comments

Comments

@runxc1
Copy link

runxc1 commented Nov 16, 2015

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?

@muratg
Copy link

muratg commented Nov 25, 2015

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

@muratg muratg added this to the Backlog milestone Dec 18, 2015
@cwe1ss
Copy link
Contributor

cwe1ss commented Feb 15, 2016

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!

@cwe1ss
Copy link
Contributor

cwe1ss commented Feb 22, 2016

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.

@runxc1
Copy link
Author

runxc1 commented Feb 22, 2016

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...

@tmds
Copy link

tmds commented Jun 8, 2016

@muratg it is a common use-case to log exceptions, why make users add the magic constant ('0') or define their own extension methods?

@runxc1
Copy link
Author

runxc1 commented Dec 1, 2016

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.

@adamhathcock
Copy link
Contributor

adamhathcock commented Mar 28, 2017

Added the overloads myself in a pull request. Yay open source.

@BrennanConroy
Copy link
Member

c149d48

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants