public static void Error(string message, LoggerBllType bllType, object args = null, [CallerFilePath] string file = null, [CallerLineNumber] int line = 0, [CallerMemberName] string member = null) { var stackInfo = GetFileInfo(file, line, member); Write(LogLevel.Error, stackInfo, message, bllType, null, args); }
public static void Warn(Exception exception, LoggerBllType bllType, object args = null, [CallerFilePath] string file = null, [CallerLineNumber] int line = 0, [CallerMemberName] string member = null) { var stackInfo = GetFileInfo(file, line, member); Write(LogLevel.Error, stackInfo, exception.StackTrace, bllType, exception, args); }
public static void Info(object message, LoggerBllType bllType, object args = null, [CallerFilePath] string file = null, [CallerLineNumber] int line = 0, [CallerMemberName] string member = null) { var stackInfo = $"{GetFileInfo(file, line, member)}"; Write(LogLevel.Info, stackInfo, message.ToString(), bllType, null, args); }
public static void Fatal(string message, Exception exception, LoggerBllType bllType, object args = null, [CallerFilePath] string file = null, [CallerLineNumber] int line = 0, [CallerMemberName] string member = null) { var stackInfo = GetFileInfo(file, line, member); Write(LogLevel.Fatal, stackInfo, message, bllType, exception, args); }
private static async void Write(LogLevel FLogLevel, string stackInfo, string message, LoggerBllType bllType, Exception exception, object args) { string argsStr = null; if (args != null) { argsStr = args.ToJson(); } await MyLogger.WriteMessage(FLogLevel, stackInfo, message, argsStr, bllType, exception); }
public async Task WriteMessage(LogLevel FLogLevel, string stackInfo, string message, string args, LoggerBllType bllType, Exception exception) { var entity = new TLogger { FBllType = bllType, FLogLevel = FLogLevel, FStackInfo = stackInfo, FMessage = message, FArgs = args, }; if (exception != null) { entity.FExceptionName = exception.GetType().Name; entity.FExceptionMessage = exception.Message; entity.FExceptionInfo = exception.ToString(); } entity.SetCreator("Sys"); ConsoleLogger.WriteMessage(entity); #if SERVER await LoggerWriter.FileWriterFatory.WriteMessage(entity); await LoggerWriter.MongoWriterFatory.WriteMessage(entity); #endif await Task.CompletedTask; }