Пример #1
0
        /// <summary>
        ///   初始化
        /// </summary>
        public static void Initialize()
        {
            var sec = ConfigurationManager.Get("LogRecorder");

            if (sec != null)
            {
                TraceToConsole = sec.GetBool("console");
                LogMonitor     = sec.GetBool("monitor");
                LogDataSql     = sec.GetBool("sql");
                Level          = Enum.TryParse <LogLevel>(sec["level"], out var level) ? level : LogLevel.Warning;
            }
#if !NETCOREAPP
            if (LogMonitor)
            {
                AppDomain.MonitoringIsEnabled = true;
            }
#endif
            State = LogRecorderStatus.Initialized;
            var recorder = IocHelper.Create <ILogRecorder>();
            if (recorder != null && recorder != BaseRecorder)
            {
                _isTextRecorder = false;
                Recorder        = recorder;
                Recorder.Initialize();
            }
            BaseRecorder.Initialize();
        }
Пример #2
0
 /// <summary>
 ///   中止
 /// </summary>
 public static void Shutdown()
 {
     State = LogRecorderStatus.Shutdown;
     Recorder.Shutdown();
     if (!_isTextRecorder)
     {
         BaseRecorder.Shutdown();
     }
 }
Пример #3
0
 /// <summary>
 ///   初始化
 /// </summary>
 /// <param name="record"> </param>
 public static void Initialize(ILogRecorder record)
 {
     if (record != null)
     {
         Recorder        = record;
         _isTextRecorder = record is TxtRecorder;
         Recorder.Initialize();
     }
     State = LogRecorderStatus.Initialized;
 }
Пример #4
0
        /// <summary>
        ///   中止
        /// </summary>
        public static void Shutdown()
        {
            State = LogRecorderStatus.Shutdown;
            syncSlim.Wait();
            if (RecordInfos.Line1.Count > 0)
            {
                BaseRecorder.RecordLog(RecordInfos.Line1);
            }
            if (RecordInfos.Line2.Count > 0)
            {
                BaseRecorder.RecordLog(RecordInfos.Line2);
            }

            if (!_isTextRecorder)
            {
                BaseRecorder.Shutdown();
            }
            Recorder.Shutdown();
        }
Пример #5
0
 /// <summary>
 ///   初始化
 /// </summary>
 public static void Initialize()
 {
     State = LogRecorderStatus.Initialized;
 }