Class LoggingBootstrap
- Namespace
- SunamoLogging.Bootstrap
- Assembly
- SunamoLogging.dll
One-call setup for the „DISKOVÉ LOGY" pattern: wipe Logs/, tee Console to app.log, register crash handler that writes to crash.log, return a configured FileLoggerProvider. Intended to be called from app entry point right after the Logs folder is known.
public static class LoggingBootstrap
- Inheritance
-
LoggingBootstrap
- Inherited Members
Methods
InitConsoleApp(string, LoggingBootstrapOptions?, Action<IServiceCollection>?)
Single-call console-app bootstrap: AppData folders, log wipe, Console tee, crash handler,
FileLoggerProvider, ServiceCollection with AddServicesEndingWithService(),
ServiceProvider built, ILogger resolved. App calls this once and gets back everything.
Use this from app static ctor: var ctx = LoggingBootstrap.InitConsoleApp("MyApp");
public static ConsoleAppContext InitConsoleApp(string appName, LoggingBootstrapOptions? options = null, Action<IServiceCollection>? configureServices = null)
Parameters
appNamestringoptionsLoggingBootstrapOptionsconfigureServicesAction<IServiceCollection>
Returns
Initialize(string, LoggingBootstrapOptions?)
Initializes disk logging end-to-end for an app. Returns a provider ready to be registered
in DI (e.g. CmdBootStrap.AddILogger(services, true, provider, appName)).
Use this if you need finer control than InitConsoleApp(string, LoggingBootstrapOptions?, Action<IServiceCollection>?).
public static FileLoggerProvider Initialize(string logsFolder, LoggingBootstrapOptions? options = null)
Parameters
logsFolderstringoptionsLoggingBootstrapOptions