You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example, if TState was a dictionary, then the logger should include each name/value pair as metadata. If the state was another object, it could serialize the object as well. I care less about having a true hierarchy of states (though that would be nice) than I do about having the metadata added and available in Stackify logs for searching.
Thanks.
The text was updated successfully, but these errors were encountered:
Your logger provider can implement ISupportExternalScope
which you need to then implement SetScopeProvider in the provider.
And you can either make your own ScopeProvider then or extend Microsofts one to do what you want by newing up LoggerExternalScopeProvider in the LoggerExternalScopeProvider
Yea its a bit gobbly gook but its actually separated out really nicely.. just not documented anywhere. We spent quite some time working this out by looking at the source code in MS.
So any way there are a few things you can do now really.. In the implementation of Log in your Logger you can access more information in the ScopeProvider. For example we loop the scope to avoid wrapping BeginScope in usings.. We just use it as tracking steps so we loop over the scopes and dump them into our logs.
We also created like our own IFormatScopes interface which we can add on our objects and when we loop the scopes we do some type checking in a switch, if we have this interface then we call the GetScopes method on it and its in the format that we want. You could also have that implement the actual log data if you wanted.
From here its all really in your control.. Just make sure its really fast to work with these scopes .. if you find your self needing to use async.. well thats wrong you cant do that.. These need to be rapid because in production you WILL have this hitting thousands of times a second if not more.
Looking at the file: https://github.com/stackify/stackify-api-dotnet/blob/master/Src/StackifyLib.CoreLogger/StackifyLogger.cs I see that BeginScope simply returns null. It would be great if the code added the state as metadata to the logs.
For example, if TState was a dictionary, then the logger should include each name/value pair as metadata. If the state was another object, it could serialize the object as well. I care less about having a true hierarchy of states (though that would be nice) than I do about having the metadata added and available in Stackify logs for searching.
Thanks.
The text was updated successfully, but these errors were encountered: