/// <summary> /// Initializes a new instance of the <see cref="GameUpdateManager"/> class. /// </summary> /// <param name="backupEngine">The backup engine.</param> /// <param name="logger">The logger.</param> /// <exception cref="System.ArgumentNullException"> /// backupEngine /// or /// logger /// </exception> public GameUpdateManager(IBackupEngine backupEngine, ILogEngine logger) { if (backupEngine == null) throw new ArgumentNullException("backupEngine"); if (logger == null) throw new ArgumentNullException("logger"); _backupEngine = backupEngine; _logger = logger; }
public IMCService() { using (var scope = Container.BeginLifetimeScope()) { logger = scope.Resolve<ILogEngine>(); } }
/// <summary> /// Default constructor /// </summary> public MinecraftService(IServerManager serverManager, IApiEngine apiEngine, ILogEngine logger) { if (serverManager == null) throw new ArgumentNullException("serverManager"); if (apiEngine == null) throw new ArgumentNullException("apiEngine"); if (logger == null) throw new ArgumentNullException("logger"); _serverManager = serverManager; _apiEngine = apiEngine; _logger = logger; InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="WebApiEngine"/> class. /// </summary> /// <param name="container">The container.</param> /// <param name="logger">The logger.</param> /// <exception cref="System.ArgumentNullException"> /// container /// or /// logger /// </exception> public WebApiEngine(IUnityContainer container, ILogEngine logger) { if (container == null) throw new ArgumentNullException("container"); if (logger == null) throw new ArgumentNullException("logger"); _container = container; _logger = logger; _port = MinecraftSettings.Default.WebApiPort; if (_port != 0) _enabled = true; }
//protected Helper.Configuration mConfig; #endregion public SQLDatabase() { logger = new LogEngine(); mConnectionString = GetConnectionString(); try { mConn = new SqlConnection(mConnectionString); } catch (Exception ex) { logger.Error(@"Can't create new sql database engine because " + ex.Message); } }
/// <summary> /// Записывает в журнал сообщение /// </summary> /// <param name="type">Тип журнала</param> /// <param name="level">Уровень сообщения</param> /// <param name="message">Сообщение</param> /// <param name="parameters">Параметры формирования сообщения</param> private static void Log(LogType type, LogLevel level, string message, params object[] parameters) { try { ILogEngine logger = GetLogger(type); if (logger == null) { return; } logger.Log(level, message, parameters); } catch (Exception le) { if (type != LogType.System) { Logger.LogException(LogType.System, LogLevel.Error, le, "Ошибка при записи в журнал {0}", type); } throw; } }
/// <summary> /// Initializes a new instance of the <see cref="PlayerManager" /> class. /// </summary> /// <param name="logger">The logger.</param> /// <exception cref="System.ArgumentNullException">logger</exception> public PlayerManager(ILogEngine logger) { if (logger == null) throw new ArgumentNullException("logger"); _logger = logger; }
public BaseDAO() { db = new SQLEngine(); logger = new LogEngine(); }
/// <summary> /// Initializes a new instance of the <see cref="BackupEngine"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <exception cref="System.ArgumentNullException">logger</exception> public BackupEngine(ILogEngine logger) { if (logger == null) throw new ArgumentNullException("logger"); _logger = logger; }
private static async Task HandleExceptionAsync(HttpContext context, Exception exception, ILogEngine logEngine) { var code = HttpStatusCode.InternalServerError; var error = exception.Message; if (exception is ResourceExistedException) { code = HttpStatusCode.Conflict; } else if (exception is PaymentRequiredException) { code = HttpStatusCode.PaymentRequired; } else if (exception is UnauthorizedException) { code = HttpStatusCode.Unauthorized; } else if (exception is NotAllowedException) { code = HttpStatusCode.Forbidden; } else if (exception is NotFoundException) { code = HttpStatusCode.NotFound; } else if (exception is InvalidParameterException) { code = HttpStatusCode.BadRequest; } else if (exception is DbUpdateConcurrencyException) { code = HttpStatusCode.RequestTimeout; error = "Db update concurrent conflict. Please retry"; } else { logEngine.LogException(exception); error = "Unexpected error"; } var result = JsonConvert.SerializeObject(new { error = error }); context.Response.ContentType = "application/json"; context.Response.StatusCode = (int)code; await context.Response.WriteAsync(result); }
/// <summary> /// Initializes a new instance of the <see cref="LogProgressMonitor" /> class. /// </summary> /// <param name="logger">The logger.</param> public LogProgressMonitor(ILogEngine logger) { _logger = logger; }
public LogManager(ILogEngine logEngine) { this._logEngine = logEngine; }
public ApolloLoader(ISeriesEngine seriesEngine, IMissionEngine missionEngine, ILogEngine logEngine) { _seriesEngine = seriesEngine; _missionEngine = missionEngine; _logEngine = logEngine; }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object" /> class. /// </summary> protected DialogIdentitiesBl(ILogEngine logEngine) { LogEngine = logEngine; AppSettingBl = AppSettingBl.GetInstance(); }
public static void Init() { try { ConfigurationBag.LoadConfiguration(); Enabled = ConfigurationBag.Configuration.LoggingEngineEnabled; //Load logging external component var loggingComponent = Path.Combine( ConfigurationBag.Configuration.DirectoryOperativeRootExeName, ConfigurationBag.Configuration.LoggingComponent); Debug.WriteLine("Check Abstract Logging Engine."); //Create the reflection method cached var assembly = Assembly.LoadFrom(loggingComponent); //Main class logging var assemblyClass = (from t in assembly.GetTypes() let attributes = t.GetCustomAttributes(typeof(LogContract), true) where t.IsClass && attributes != null && attributes.Length > 0 select t).First(); LogEngineComponent = Activator.CreateInstance(assemblyClass) as ILogEngine; Debug.WriteLine("LogEventUpStream - Inizialize the external log"); LogEngineComponent.InitLog(); Debug.WriteLine("Initialize Abstract Logging Engine."); Debug.WriteLine("LogEventUpStream - CreateEventSource if not exist"); if (!EventLog.SourceExists(EventViewerSource)) { EventLog.CreateEventSource(EventViewerSource, EventViewerLog); } //Create the QueueConsoleMessage internal queue Debug.WriteLine( "LogEventUpStream - logQueueConsoleMessage.OnPublish += LogQueueConsoleMessageOnPublish"); QueueConsoleMessage = new LogQueueConsoleMessage( ConfigurationBag.Configuration.ThrottlingConsoleLogIncomingRateNumber, ConfigurationBag.Configuration.ThrottlingConsoleLogIncomingRateSeconds); QueueConsoleMessage.OnPublish += QueueConsoleMessageOnPublish; //Create the QueueAbstractMessage internal queue Debug.WriteLine( "LogEventUpStream - logQueueAbstractMessage.OnPublish += LogQueueAbstractMessageOnPublish"); QueueAbstractMessage = new LogQueueAbstractMessage( ConfigurationBag.Configuration.ThrottlingLsiLogIncomingRateNumber, ConfigurationBag.Configuration.ThrottlingLsiLogIncomingRateSeconds); QueueAbstractMessage.OnPublish += QueueAbstractMessageOnPublish; Debug.WriteLine("LogEventUpStream - Log Queues initialized."); } catch (Exception ex) { DirectEventViewerLog($"Error in {MethodBase.GetCurrentMethod().Name} - {ex.Message}", 1); WriteLog( ConfigurationBag.EngineName, $"Error in {MethodBase.GetCurrentMethod().Name}", Constant.LogLevelError, Constant.TaskCategoriesError, ex, Constant.LogLevelError); Environment.Exit(0); } }
/// <summary> /// Initializes a new instance of the <see cref="ServerManager"/> class. /// </summary> /// <param name="playerManager">The player manager.</param> /// <param name="gameUpdateManager">The game update manager.</param> /// <param name="backupEngine">The backup engine.</param> /// <param name="logger">The logger.</param> /// <exception cref="System.ArgumentNullException"> /// playerManager /// or /// gameUpdateManager /// or /// backupEngine /// or /// logger /// </exception> public ServerManager(IPlayerManager playerManager, IGameUpdateManager gameUpdateManager, IBackupEngine backupEngine, ILogEngine logger) { if (playerManager == null) throw new ArgumentNullException("playerManager"); if (gameUpdateManager == null) throw new ArgumentNullException("gameUpdateManager"); if (backupEngine == null) throw new ArgumentNullException("backupEngine"); if (logger == null) throw new ArgumentNullException("logger"); _playerManager = playerManager; _gameUpdateManager = gameUpdateManager; _backupEngine = backupEngine; _logger = logger; _javaPath = MinecraftSettings.Default.JavaPath; _version = MinecraftSettings.Default.MinecraftVersion; _memory = MinecraftSettings.Default.Memory; _permGen = MinecraftSettings.Default.PermGen; _serverPath = Path.GetFullPath("./Server/"); Directory.CreateDirectory(_serverPath); }
public AutomationTeamSpeakBl(ILogEngine logEngine) { _logEngine = logEngine; }
public QueryResolver(ISeriesEngine seriesEngine, IMissionEngine missionEngine, ILogEngine logEngine, IEventEngine eventEngine) { _seriesEngine = seriesEngine; _missionEngine = missionEngine; _logEngine = logEngine; _eventEngine = eventEngine; }