Example #1
0
        public void Report(SpiderStatus status)
        {
            string       msg      = $"Left {status.Left} Success {status.Success} Error {status.Error} Total {status.Total} Dowload {status.AvgDownloadSpeed} Extract {status.AvgProcessorSpeed} Pipeline {status.AvgPipelineSpeed}";
            LogEventInfo theEvent = new LogEventInfo(NLog.LogLevel.Trace, "", msg);

            theEvent.Properties["UserId"]            = status.UserId;
            theEvent.Properties["TaskGroup"]         = status.TaskGroup;
            theEvent.Properties["Identity"]          = status.Identity;
            theEvent.Properties["Status"]            = status.Status;
            theEvent.Properties["Left"]              = status.Left;
            theEvent.Properties["Success"]           = status.Success;
            theEvent.Properties["Error"]             = status.Error;
            theEvent.Properties["Total"]             = status.Total;
            theEvent.Properties["AvgDownloadSpeed"]  = status.AvgDownloadSpeed;
            theEvent.Properties["AvgProcessorSpeed"] = status.AvgProcessorSpeed;
            theEvent.Properties["AvgPipelineSpeed"]  = status.AvgPipelineSpeed;

            if (SpiderConsts.SaveLogAndStatusToDb)
            {
                NetworkCenter.Current.Execute("nm", () =>
                {
                    _logger.Log(theEvent);
                });
            }
            else
            {
                _logger.Log(theEvent);
            }
        }
Example #2
0
        public void Watch(SpiderStatus status)
        {
            string       msg      = $"Left {status.Left} Success {status.Success} Error {status.Error} Total {status.Total} Thread {status.ThreadNum}";
            LogEventInfo theEvent = new LogEventInfo(LogLevel.Trace, "", msg);

            theEvent.Properties["UserId"]    = status.UserId;
            theEvent.Properties["TaskGroup"] = status.TaskGroup;
            theEvent.Properties["Identity"]  = status.Identity;
            theEvent.Properties["Status"]    = status.Status;
            theEvent.Properties["Message"]   = msg;
            NetworkCenter.Current.Execute("nm", () =>
            {
                _logger.Log(theEvent);
            });
        }