コード例 #1
0
        public static void WriteErrLog(Exception ex)
        {
            if (ExceptionlessClient != null)
            {
                Exceptionlogger.LogInfo(ex);
            }
            else
            {
                var logEntity = new LogEntity
                {
                    LogType    = ex.GetType().FullName,
                    LogDetail  = CreateErrDetail(ex),
                    LogMessage = ex.Message,
                    LogTime    = DateTime.Now
                };

                Filelogger.LogInfo(logEntity);
            }
        }
コード例 #2
0
        private static void WriteMessageToExceptionless(LogEntity logEntity, LogLevel logLevel)
        {
            var tag = "信息";

            if (logLevel == LogLevel.Warn)
            {
                tag = "警告";
            }
            if (logLevel == LogLevel.Trace)
            {
                tag = "跟踪";
            }
            ExceptionlessClient.CreateLog(logEntity.ToString(), logLevel)
            .AddTags(tag)
            .SetReferenceId(Guid.NewGuid().ToString("N"))
            .SetProperty("IpAddress", Computer.IpAddress)
            .SetProperty("MacAddress", Computer.MacAddress)
            .Submit();
        }
コード例 #3
0
        public static void WriteTraceLog(string info)
        {
            if (!LogTraceEnable)
            {
                return;
            }
            var logEntity = new LogEntity
            {
                LogType    = "跟踪",
                LogDetail  = string.Empty,
                LogMessage = info,
                LogTime    = DateTime.Now
            };

            if (ExceptionlessClient != null)
            {
                Tracelogger.LogInfo(logEntity);
            }
            else
            {
                Filelogger.LogInfo(logEntity);
            }
        }