/// <summary> /// Removes the specified IChatLoggers. /// </summary> /// <param name="logger">The IChatLoggers.</param> /// <exception cref="System.InvalidOperationException">Can't remove an IChatLogger that is not added.</exception> public override void Remove(IChatLogger logger) { if (!this.ChatLoggers.Contains(logger)) { throw new InvalidOperationException("Can't remove an IChatLogger that is not added."); } this.ChatLoggers.Remove(logger); }
/// <summary> /// Adds the specified IChatLoggers. /// </summary> /// <param name="logger">The IChatLoggers.</param> /// <exception cref="System.InvalidOperationException">Can't add multiple similar instances of IChatLogger</exception> public override void Add(IChatLogger logger) { if (this.ChatLoggers.Contains(logger)) { throw new InvalidOperationException("Can't add multiple similar instances of IChatLogger"); } this.ChatLoggers.Add(logger); }
/// <summary> /// Updates the logged strings. /// </summary> /// <param name="logger">The logger.</param> protected override void UpdateLogged(IChatLogger logger) { foreach (var messageToAdd in logger.Logged) { foreach (var existingMessage in this.LoggedMessages) { if (messageToAdd.Equals(existingMessage)) { continue; } this.OnMessageLogged(); this.LoggedMessages.Add(messageToAdd); } } }
public RoomManager() { _logger = ChatLoggerService.Instance; }
public UserManager() { _logger = ChatLoggerService.Instance; }
/// <summary> /// Removes the specified IChatLoggers. /// </summary> /// <param name="logger">The IChatLoggers.</param> /// <exception cref="System.InvalidOperationException">Can't remove an IChatLogger that is not added.</exception> public abstract void Remove(IChatLogger logger);
/// <summary> /// Adds the specified IChatLoggers. /// </summary> /// <param name="logger">The IChatLoggers.</param> /// <exception cref="System.InvalidOperationException">Can't add multiple similar instances of IChatLogger</exception> public abstract void Add(IChatLogger logger);
/// <summary> /// Updates the logged strings. /// </summary> /// <param name="logger">The logger.</param> protected abstract void UpdateLogged(IChatLogger logger);
protected void Application_Error(object sender, EventArgs e) { _logger = ChatLoggerService.Instance; _logger.Info("Ooops" + sender.ToString()); }