Пример #1
0
        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);
        }
Пример #2
0
        //寫入錯誤紀錄
        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);
        }