-
Notifications
You must be signed in to change notification settings - Fork 174
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
Remove static logging and replacing with DI-friendly system #483
Merged
Commits on Feb 1, 2023
-
WIP: First pass at removing static logging and replacing with a more …
…DI approach for #455 Attempted as much as possible to break few contracts, and provide forwarding to new implementation Removed dependence on Microsoft.Extensions.Logging, but added Microsoft.Extensions.DependencyInjection Works by introducing an internal DI ServiceCollection and ServiceProvider available via a singleton resource. This collection can be configured by a consumer, but services will work out the box without any config (just with Null Logging) Consumers can add own logging, either with AddLogging(), or by telliing xbim to UseLoggerFactory(logFactory). Removed public Setter ILoggers. Because we're not fully in control of DI composition favoured approach is to inject/pass in ILoggerFactory to key roots. We're using ServiceLocator anti-pattern in other cases as a last resort. ModelProvider & Factory has been re-worked to actually work with DI. One subtle change - Previosuly Heuristic ModelProvider kicked in if Esent was loaded. Now that needs to be set explicitly when configuring the app. i.e. XbimServices.Current.ConfigureServices(s => s.AddXbimToolkit(opt => opt.UseHeuristicModel())); Legacy 'DI lite' concepts like IfcStore.ModelProviderFactory.UseHeuristicModelProvider() have been remapped to a new approach and Obsoleted. TODO: many tests use the old obsoleted overloads, which forward onto new . All tests pass (with one flaky IfcStore ModelProvider test to resolve)
Configuration menu - View commit details
-
Copy full SHA for 4cdaf8b - Browse repository at this point
Copy the full SHA 4cdaf8bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4828878 - Browse repository at this point
Copy the full SHA 4828878View commit details -
Caused by random sequencing of tests and shared state
Configuration menu - View commit details
-
Copy full SHA for daf34bb - Browse repository at this point
Copy the full SHA daf34bbView commit details -
Fixed up defaults on obsolete methods so typical upgraders will auto pick up new implementations by default. i.e. will default to ILoggerFactory signature over ILogger when caller didn't provide any logger Addresses all test warnings except Scanner
Configuration menu - View commit details
-
Copy full SHA for 1315fd5 - Browse repository at this point
Copy the full SHA 1315fd5View commit details
Commits on Feb 2, 2023
-
Esent model now included in Xbim.Ifc again so we don't default to Mem…
…oryModel. Added some guards/logging to Esent & Heurisrstic ModelProvider infrastructure when used under non WIndows o/s
Configuration menu - View commit details
-
Copy full SHA for b3fce6f - Browse repository at this point
Copy the full SHA b3fce6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 28ca0a4 - Browse repository at this point
Copy the full SHA 28ca0a4View commit details -
Removed all ILoggerFactory params on static factory methods.
Replaced by ServiceLocator None-breaking as these were only added lately after obsoleting the equivalent ILogger param methods and related DI work
Configuration menu - View commit details
-
Copy full SHA for 313b7b4 - Browse repository at this point
Copy the full SHA 313b7b4View commit details -
We're mix & match xUnit and vsTest... xUnit classes need Bootstrapping reliably or sequencing issues can trigger failures in singleton state
Configuration menu - View commit details
-
Copy full SHA for 9c431d2 - Browse repository at this point
Copy the full SHA 9c431d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 049b8dc - Browse repository at this point
Copy the full SHA 049b8dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3bd3525 - Browse repository at this point
Copy the full SHA 3bd3525View commit details -
Configuration menu - View commit details
-
Copy full SHA for bf1d932 - Browse repository at this point
Copy the full SHA bf1d932View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.