Esempio n. 1
0
        /// <summary>
        /// 日志收集(报错)
        /// </summary>
        /// <param name="QueueKey">队列名称</param>
        /// <param name="Ex">错误信息</param>
        /// <param name="Url">路径</param>
        /// <param name="Token">Token</param>
        /// <param name="RabbitMQPushService">MQ类接口</param>
        public void LogCollectPush(string QueueKey, Exception Ex, string Url, string Token, IRabbitMQPushService RabbitMQPushService)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };
            var LogErrorDetails = new LogErrorDetails()
            {
                CreateTime = DateTime.Now,
                Url        = Url,
                Messsage   = JsonConvert.SerializeObject(Ex, settings),
                Token      = Token,
            };

            RabbitMQPushService.PushMessage(QueueKey, JsonConvert.SerializeObject(LogErrorDetails));
        }
Esempio n. 2
0
        /// <summary>
        /// 日志收集(报错)
        /// </summary>
        /// <param name="QueueKey">队列名称</param>
        /// <param name="Ex">错误信息</param>
        /// <param name="Url">路径</param>
        /// <param name="Token">Token</param>
        /// <param name="Logger">MQ类接口</param>
        public void LogCollectPush(string QueueKey, Exception Ex, string Url, string Token, ILoggerRepository Logger)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };
            var LogErrorDetails = new LogErrorDetails()
            {
                CreateTime = DateTime.Now,
                Url        = Url,
                Messsage   = JsonConvert.SerializeObject(Ex, settings),
                Token      = Token,
            };

            LogManager.GetLogger(Logger.Name, Url).Debug(JsonConvert.SerializeObject(LogErrorDetails));
        }