/// <summary> /// If no configuration is provided, then create a default one. /// </summary> private void SetDefaultConfiguration() { if (Configuration != null) { return; } Configuration = new StfLoggerConfiguration(); }
/// <summary> /// Initializes a new instance of the <see cref="StfKernel"/> class. /// </summary> public StfKernel() { StfTextUtils = new StfTextUtils(); // setup needed kernel directories KernelSetupKernelDirectories(); // lets get a logger and a configuration var uniqueKernelLoggerFilename = StfTextUtils.AppendUniquePartToFileName("KernelLogger.html"); var kernelLoggerFilename = Path.Combine(StfKernelLogDir, uniqueKernelLoggerFilename); var kernelLoggerConfiguration = new StfLoggerConfiguration { LogTitle = "KernelLog", LogFileName = kernelLoggerFilename, LogLevel = StfLogLevel.Internal }; KernelLogger = new StfLogger(kernelLoggerConfiguration); // get the initial configuration together - at this point in time: Only the kernel configuration AssembleStfConfigurationBeforePlugins(); // Any plugins for us? PluginLoader = new StfPluginLoader(KernelLogger, StfConfiguration); PluginLoader.RegisterInstance(typeof(StfConfiguration), StfConfiguration); if (StfConfiguration.TryGetKeyValue("Configuration.StfKernel.PluginPath", out var pluginPath)) { // TODO: Check for existing config file. If file not found then create default template configuration PluginLoader.LoadStfPlugins(pluginPath); } AssembleStfConfigurationAfterPlugins(); // now all configurations are loaded, we can set the Environment. StfConfiguration.Environment = StfConfiguration.DefaultEnvironment; LoadConfigurationForStfTypes(); DumpStfConfiguration(); KernelLogger.LogKeyValue("Stf Root", StfRoot, "The Stf Root directory"); }