/// <summary> /// Log Output to the LogFile /// </summary> /// <param name="loggerObject"></param> public void Log(ILoggerObject loggerObject) { // Append if File Exists using (FileStream logFile = new FileStream(LogFilename, FileMode.Append, FileAccess.Write)) using (StreamWriter streamWriter = new StreamWriter(logFile)) { streamWriter.WriteLine(loggerObject.SolutionContext + "\t" + loggerObject.ProcessContext + "\t" + loggerObject.OperationContext); streamWriter.Close(); } }
public static void Log(LoggerCofiguration.LogProvider provider, ILoggerObject loggerObject) { switch (provider) { case LoggerCofiguration.LogProvider.File: logger = new FileLogger(); logger.Log(loggerObject); break; } //var logger = IoC.Unity.Resolve<ILogger>("provider"); // logger.Log(...); }
/// <summary> /// Formats and writes an critical error log message. /// </summary> /// <param name="obj">The SigStat.Common.ILoggerObject containing the Logger to write to.</param> /// <param name="message">Format string of the log message in message template format. Example: "User {User} logged in from {Address}"</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void LogCritical(this ILoggerObject obj, string message, params object[] args) { obj.Logger?.LogCritical(message, args); }
/// <summary> /// Formats and writes an warning log message. /// </summary> /// <param name="obj">The SigStat.Common.ILoggerObject containing the Logger to write to.</param> /// <param name="exception">The exception to log.</param> /// <param name="message">Format string of the log message in message template format. Example: "User {User} logged in from {Address}"</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void LogWarning(this ILoggerObject obj, Exception exception, string message, params object[] args) { obj.Logger?.LogWarning(exception, message, args); }
/// <summary> /// Formats and writes an informational log message. /// </summary> /// <param name="obj">The SigStat.Common.ILoggerObject containing the Logger to write to.</param> /// <param name="message">Format string of the log message in message template format. Example: "User {User} logged in from {Address}"</param> /// <param name="args">An object array that contains zero or more objects to format.</param> public static void LogInformation(this ILoggerObject obj, string message, params object[] args) { obj.Logger?.LogInformation(message, args); }
public void Log(ILoggerObject loggerObject) { throw new NotImplementedException(); }