/// <summary> /// Use this method to unregister a previously registered <see cref="IActorRuntimeLog"/>. /// </summary> internal void RemoveLog(IActorRuntimeLog log) { if (log != null) { this.Logs.Remove(log); } }
/// <summary> /// Use this method to register an <see cref="IActorRuntimeLog"/>. /// </summary> internal void RegisterLog(IActorRuntimeLog log) { if (log is null) { throw new InvalidOperationException("Cannot register a null log."); } // Make sure we only have one text logger if (log is ActorRuntimeLogTextFormatter a) { var textLog = this.GetLogsOfType <ActorRuntimeLogTextFormatter>().FirstOrDefault(); if (textLog != null) { this.Logs.Remove(textLog); } if (this.Logger != null) { a.Logger = this.Logger; } } this.Logs.Add(log); }