Previously only silenced only in tests, it is needed globally now since
the warning isn't smart enough to detect DI/runtime usages, which
results in many false positives when tests utilizing DI reference those
types.
User feedback was that it's difficult to understand what to correct in
git configuration if the git error message is not shown to users.
Contributes to #355
Previously, code was organized into projects that were too granular.
This resulted in slower solution builds in addition to added complexity.
Most class library projects have been consolidated into a single
project, Recyclarr.Core.
Added ISettings interface to allow injection of a specific subset of
settings into areas of code. This replaced the old ISettingsProvider
method of accessing settings.
- Consistently use ExitStatus enum.
- Where appropriate, do not handle exceptions in isolation in the
command class itself. Rather, let exceptions through to the entrypoint
so the centralized exception handler can deal with them.
This commit introduces significant changes to the initialization process
of Spectre.Console and the logging system:
1. Logger Initialization:
- Implement a two-phase initialization for the LoggerFactory.
- First phase creates an ILogger writing to the CLI console without
runtime configuration.
- Second phase wraps the initial logger with additional sinks (e.g.,
file logging) based on CLI arguments.
2. Spectre.Console Setup:
- Refactor AutofacTypeRegistrar to store registrations in lists.
- Implement Build() method to register types with Autofac when
called.
- This approach better aligns with Autofac's registration and
resolution separation.
3. Global Setup Tasks:
- Introduce AppDataDirSetupTask and LoggerSetupTask.
- Modify IGlobalSetupTask interface to accept BaseCommandSettings.
- Update existing setup tasks to conform to the new interface.
4. Error Handling:
- Implement top-level exception handling in Program.Main().
- Remove IFlurlHttpExceptionHandler interface, simplify
FlurlHttpExceptionHandler.
5. Logging Improvements:
- Move console logging setup to LoggerFactory.
- Introduce IndirectLoggerDecorator to allow dynamic logger updates.
- Simplify log template management.
6. Dependency Injection:
- Update CompositionRoot to reflect new logger and setup task
structure.
- Remove LoggingAutofacModule, integrate its functionality into
CompositionRoot.
These changes improve the flexibility and maintainability of the
application's startup process, particularly in handling logging and CLI
argument processing. The new structure allows for more dynamic
configuration of services based on runtime parameters.