public void Write( object message, Exception exception = null, LoggerDebugLevels selectedLevel = LoggerDebugLevels.Debug, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string functionName = "" ) { bool? configurationFileReloaded = ConfigurationFileChanged(logConfigurationFilePath); if (!configurationFileReloaded.HasValue) { WriteConfigurationDebuggingInformation( "The configuration file located at [{0}] could not be (re)loaded. Please check the file path.", logConfigurationFilePath ); return; } if (configurationFileReloaded.Value) { WriteConfigurationDebuggingInformation( "The configuration file located at [{0}] was (re)loaded successfully.", logConfigurationFilePath ); } else { WriteConfigurationDebuggingInformation( "The configuration file located at [{0}] had no changes.", logConfigurationFilePath ); } SetPredefinedGlobalLogVariables(filePath, lineNumber, functionName, selectedLevel.ToString()); SelectWriter(message, exception, selectedLevel); }
public void SelectWriter(object message, Exception exception, LoggerDebugLevels selectedLevel) { switch (selectedLevel) { case LoggerDebugLevels.Emergency: case LoggerDebugLevels.Alert: case LoggerDebugLevels.Critical: log.Fatal(message, exception); break; case LoggerDebugLevels.Error: log.Error(message, exception); break; case LoggerDebugLevels.Warning: log.Warn(message, exception); break; case LoggerDebugLevels.Notification: case LoggerDebugLevels.Informational: log.Info(message, exception); break; case LoggerDebugLevels.Debug: case LoggerDebugLevels.Test: case LoggerDebugLevels.Profile: default: log.Debug(message, exception); break; } }