public void LogInfo(string message) { var prjName = Assembly.GetCallingAssembly().GetName().Name; MongoLog log = new MongoLog { message = message, logLevel = "INFO" }; _db.GetCollection <MongoLog>($"{prjName}_log").InsertOne(log); }
//寫入錯誤紀錄 public void LogError(Exception exception) { var prjName = Assembly.GetCallingAssembly().GetName().Name; MongoLog log = new MongoLog { message = exception.Message, logLevel = "ERROR", stackTrace = exception.StackTrace }; _db.GetCollection <MongoLog>($"{prjName}_log").InsertOne(log); }