-
Notifications
You must be signed in to change notification settings - Fork 835
Method to get source for each configuration element #768
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
Conversation
What does it look like? Show an example? |
@davidfowl Here's an example:
|
Nice, did you happen to try the KeyPerFile provider? I'm curious what that looks like in debug |
@HaoK Every provider other than XML produces this output for the common test data:
Where => $"{GetType().Name} ({(Source.Optional ? "Optional" : "Required")})"; But we should probably put the filename in there as well. (It doesn't look easily accessible right now, but that could be changed.) |
What do you think about implementing ToString on every |
@HaoK Sounds reasonable. I'll make that change. |
@HaoK Doesn't look like there is a public or even common way to get from a provider to the source. |
Fixes #609 by allowing the configuration paths to be associated with values to help with debugging.
4d47635
to
a70bcd3
Compare
@HaoK Pushed an update that includes the directory from which the key files are loaded in the debug output. |
@ajcvickers I was just suggesting modifying the ToString in the providers i.e. in FileConfigurationProvider:
|
@HaoK What's the advantage? |
Its not that different I guess since the providers and sources are always a pair, but the settings are more a concern of the source than the provider, that was the idea behind splitting them out anyways. I was just thinking for the new StreamProvider, if the base ConfigurationProvider implemented ToString() as that, I would only have to implement The tradeoff mostly is between whether we want to have most Sources implement ToString(). Which I think we actually should have every source print out something. MemoryConfigurationSource could print out something small too like |
@HaoK Maybe you should take a look while doing the stream work and refactor then if it makes sense to you? |
Sounds good, this should be fine to merge I can tweak in my PR (although that might be a while unless you think I should decouple the stream changes from the new json stack?) |
@HaoK Let's not separate them yet... |
Fixes #609 by allowing the configuration paths to be associated with values to help with debugging.