/// <summary> /// Removes a logger from the collection. /// </summary> /// <param name="logId">Id of the logger to remove.</param> public Result Remove(string logId) { try { if (string.IsNullOrEmpty(logId) || !LoggerSet.ContainsKey(logId)) { return(Result.SingleWarning(Warnings.LoggerDoesNotExist, logId)); } LoggerSet.Remove(logId); return(Result.Success); } catch (Exception e) { return(Result.Error(e)); } }
/// <summary> /// Adds a single logger to the collection. /// </summary> /// <param name="logger">Logger to add.</param> public Result Add(IResultLogger logger) { if (ReferenceEquals(logger, null)) { return(Result.SingleError(Errors.AddingNullLoggerToCollection)); } try { var key = logger.Id; if (LoggerSet.ContainsKey(key)) { return(Result.SingleWarning(Warnings.LoggerAlreadyExists, key)); } LoggerSet.Add(key, logger); return(Result.Success); } catch (Exception e) { return(Result.Error(e)); } }