示例#1
0
 private void DisposeLoggers()
 {
     _eventLog?.Dispose();
     _eventLog = null;
     _messageLog?.Dispose();
     _messageLog = null;
 }
示例#2
0
 public void Dispose()
 {
     logger.LogDebug("Disposing UtilityBase");
     this.host.Dispose();
     logger.LogDebug("CloseAndFlush Logging");
     serilogLogger.Dispose();
 }
示例#3
0
        public void Dispose()
        {
            _diagnosticNotifier?.Dispose();

            _server.Dispose();

            _logger.Dispose();
        }
示例#4
0
 public static void CloseAndFlush()
 {
     if (serilogLogger != null)
     {
         serilogLogger.Dispose();
     }
     _LoggerFactory = null;
 }
示例#5
0
 public static void CloseUartLog()
 {
     if (uartLogFile == null)
     {
         return;
     }
     uartLogFile.Dispose();
     uartLogFile = null;
 }
示例#6
0
 public static void CloseLuaLog()
 {
     if (luaLogFile == null)
     {
         return;
     }
     luaLogFile.Dispose();
     luaLogFile = null;
 }
示例#7
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed || !disposing)
            {
                return;
            }

            _logger?.Dispose();
            _logger   = null;
            _disposed = true;
        }
示例#8
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    factory.Dispose();
                }
                disposedValue = true;
            }
        }
示例#9
0
文件: Logger.cs 项目: atEaE/dosh
        /// <summary>
        /// Destroy the resource.
        /// </summary>
        /// <param name="disposing">disposing</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                }

                fileLogger.Dispose();
                disposed = true;
            }
        }
        /// <summary>
        ///     Setting dispose
        /// </summary>
        /// <param name="disposing">Disposing value</param>
        private void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (_logger != null)
                {
                    _logger.Dispose();
                    _disposed = true;
                }
            }
        }
示例#11
0
        public virtual void ScriptFinished(ScriptFinishedEventArgs.ScriptFinishedResult result, string error = null)
        {
            engineLogger.Information("Result Code: " + result.ToString());



            if (error == null)
            {
                engineLogger.Information("Error: None");
            }
            else
            {
                engineLogger.Information("Error: " + error);
            }

            engineLogger.Dispose();


            CurrentStatus = EngineStatus.Finished;
            ScriptFinishedEventArgs args = new ScriptFinishedEventArgs();

            args.LoggedOn      = DateTime.Now;
            args.Result        = result;
            args.Error         = error;
            args.ExecutionTime = sw.Elapsed;
            args.FileName      = FileName;

            Core.Sockets.SocketClient.SendExecutionLog("Result Code: " + result.ToString());
            Core.Sockets.SocketClient.SendExecutionLog("Total Execution Time: " + sw.Elapsed);


            //convert to json
            var serializedArguments = Newtonsoft.Json.JsonConvert.SerializeObject(args);

            //write execution metrics
            if ((engineSettings.TrackExecutionMetrics) && (FileName != null))
            {
                var summaryLogger = new Logging().CreateJsonLogger("Execution Summary", Serilog.RollingInterval.Infinite);
                summaryLogger.Information(serializedArguments);
                summaryLogger.Dispose();
            }


            ScriptFinishedEvent?.Invoke(this, args);
        }
示例#12
0
 public void Dispose()
 {
     _serilogLogger?.Dispose();
 }
示例#13
0
        public virtual void ScriptFinished(ScriptFinishedEventArgs.ScriptFinishedResult result, string error = null)
        {
            engineLogger.Information("Result Code: " + result.ToString());

            //add result variable if missing
            var resultVar = VariableList.Where(f => f.VariableName == "taskt.Result").FirstOrDefault();

            //handle if variable is missing
            if (resultVar == null)
            {
                resultVar = new Script.ScriptVariable()
                {
                    VariableName = "taskt.Result", VariableValue = ""
                };
            }

            //check value
            var resultValue = resultVar.VariableValue.ToString();


            if (error == null)
            {
                engineLogger.Information("Error: None");

                if (taskModel != null && serverSettings.ServerConnectionEnabled)
                {
                    HttpServerClient.UpdateTask(taskModel.TaskID, "Completed", "Script Completed Successfully");
                }

                if (string.IsNullOrEmpty(resultValue))
                {
                    TasktResult = "Successfully Completed Script";
                }
                else
                {
                    TasktResult = resultValue;
                }
            }

            else
            {
                engineLogger.Information("Error: " + error);

                if (taskModel != null)
                {
                    HttpServerClient.UpdateTask(taskModel.TaskID, "Error", error);
                }

                TasktResult = error;
            }

            engineLogger.Dispose();


            CurrentStatus = EngineStatus.Finished;
            ScriptFinishedEventArgs args = new ScriptFinishedEventArgs();

            args.LoggedOn      = DateTime.Now;
            args.Result        = result;
            args.Error         = error;
            args.ExecutionTime = sw.Elapsed;
            args.FileName      = FileName;

            Core.Server.SocketClient.SendExecutionLog("Result Code: " + result.ToString());
            Core.Server.SocketClient.SendExecutionLog("Total Execution Time: " + sw.Elapsed);


            //convert to json
            var serializedArguments = Newtonsoft.Json.JsonConvert.SerializeObject(args);

            //write execution metrics
            if ((engineSettings.TrackExecutionMetrics) && (FileName != null))
            {
                var summaryLogger = new Logging().CreateJsonLogger("Execution Summary", Serilog.RollingInterval.Infinite);
                summaryLogger.Information(serializedArguments);
                summaryLogger.Dispose();
            }


            Core.Client.EngineBusy = false;


            if (serverSettings.ServerConnectionEnabled)
            {
                HttpServerClient.CheckIn();
            }


            ScriptFinishedEvent?.Invoke(this, args);
        }
示例#14
0
 public void Dispose()
 {
     _sLogger.Dispose();
 }
示例#15
0
 public void Dispose()
 => _logger.Dispose();
示例#16
0
 public void Dispose()
 {
     _logger?.Dispose();
 }