/// <summary> /// Add a destination to this logger. An attempt to add a destination twice will be ignored. /// </summary> /// <param name="destination">The destination to add.</param> public void AddDestination(ILogDestination destination) { lock (synchronizationLock) { destinations.Add(destination); } }
public void RemoveLogDestination(ILogDestination logDestination) { if (logDestination != null) { if (logDestination.IsRunning) { logDestination.Stop(); } lock (_destinations) { var index = _destinations.FindIndex(d => d.Id == logDestination.Id); if (index > -1) { _destinations.RemoveAt(index); } else { Log(string.Format("Unable to remove LogDestination, cannot find destination with an id of \"{0}\".", logDestination.Id), LogMessageSeverity.Warning); } } } else { Log("Cannot remove Null LogDestination...", LogMessageSeverity.Error); } }
/// <summary> /// Remove a destination from this logger. /// </summary> /// <param name="destination">The destination to remove.</param> public void RemoveDestination(ILogDestination destination) { lock (synchronizationLock) { destinations.Remove(destination); } }
/// <summary> /// Returns whether this logger is logging to the given destination. /// </summary> /// <param name="destination">The destination.</param> /// <returns>Whether this logger is logging to the given destination.</returns> public bool ContainsDestination(ILogDestination destination) { lock (synchronizationLock) { return(destinations.Contains(destination)); } }
public Processor(ILogSource source, ILogDestination destination, int maxBatchToProcess, IEnumerable <ISanitizer> sanitizerList, ILogger <Processor> logger) { _source = source ?? throw new ArgumentNullException(nameof(source)); _destination = destination ?? throw new ArgumentNullException(nameof(destination)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _sanitizerList = sanitizerList ?? throw new ArgumentNullException(nameof(sanitizerList)); _maxBatchToProcess = maxBatchToProcess; }
/// <summary> /// Adds the target to the list. /// </summary> /// <param name="target">The log target.</param> /// <param name="loglevel">The minimum log level to consider</param> /// <param name="filter">The log filter.</param> public void AddTarget(ILogDestination target, LogMessageType loglevel, Library.Utility.IFilter filter) { if (target == null) { return; } m_targets.Add(new Tuple <ILogDestination, LogMessageType, Library.Utility.IFilter>(target, loglevel, filter ?? new Library.Utility.FilterExpression())); }
/// <summary> /// Initializes a new instance of the <see cref="T:Duplicati.Library.Logging.LogWrapper"/> class. /// </summary> /// <param name="self">The log instance to wrap.</param> /// <param name="filter">The log filter to use</param> public LogScope(ILogDestination self, ILogFilter filter, LogScope parent) { Parent = parent; m_log = self; m_filter = filter; if (parent != null) { Logging.Log.StartScope(this); } }
public void Dispose() { if (m_serverfile != null) { var sf = m_serverfile; m_serverfile = null; if (sf is IDisposable) { ((IDisposable)sf).Dispose(); } } }
public void SetServerFile(string path, LogMessageType level) { var dir = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(path)); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } m_serverfile = new StreamLogDestination(path); m_serverloglevel = level; UpdateLogLevel(); }
public void Register() { if (_destination == null) { _destination = new RemoteLogViewerDestination(_callback); _logger.Log(string.Format("Registering RemoteLogViewerDestination with id \"{0}\".", _destination.Id)); _logger.AddLogDestination(_destination); } else { throw new NotSupportedException("Client has already registered to view remote logs."); } }
public void Unregister() { if (_destination != null) { _logger.Log(string.Format("Unregistering RemoteLogViewerDestination with id \"{0}\".", _destination.Id)); _logger.RemoveLogDestination(_destination); _destination = null; } else { throw new NotSupportedException("Client has not registered to view remote logs."); } }
public void AddLogDestination(ILogDestination logDestination) { if (logDestination != null) { if (IsRunning) { logDestination.Start(); } lock (_destinations) { _destinations.Add(logDestination); } } else { Log("Cannot add Null LogDestination...", LogMessageSeverity.Error); } }
public bool AddDestination(ILogDestination destination) { return(destinations.Add(destination)); }
public bool RemoveDestination(ILogDestination destination) { return(destinations.Remove(destination)); }
/// <summary> /// This method registers a destination to Logzy. The destination will be used /// to deliver created log lines. /// </summary> /// <param name="destination">An ILogDestination implementation.</param> /// <returns>The registered ILogDestination instance.</returns> public ILogDestination RegisterDestination(ILogDestination destination) { LogDestinations.Add(destination); return destination; }
/// <summary> /// Unregisters an ILogDestination instance from the list of destinations. /// </summary> /// <param name="destination"></param> public void UnregisterDestination(ILogDestination destination) { LogDestinations.Remove(destination); }
/// <summary> /// Initializes a new instance of the <see cref="T:Duplicati.Library.Main.ControllerMultiLogTarget"/> class. /// </summary> /// <param name="target">The log target.</param> /// <param name="loglevel">The minimum log level to consider</param> /// <param name="filter">The log filter.</param> public ControllerMultiLogTarget(ILogDestination target, Logging.LogMessageType loglevel, Library.Utility.IFilter filter) { AddTarget(target, loglevel, filter); }
public void AddLogDestination(ILogDestination logDestination) { //ignore }
/// <summary> /// Starts a new scope, that can be stopped by disposing the returned instance /// </summary> /// <param name="log">The log target</param> /// <param name="level">The log level</param> /// <returns>The new scope.</returns> public static IDisposable StartScope(ILogDestination log, LogMessageType level) { return(StartScope(log, new LogTagFilter(level, null, null))); }
/// <summary> /// .ctor for the Collector /// </summary> /// <param name="source">The source of the Collector.</param> /// <param name="destination">The destination for the collector.</param> public Collector(ILogSource source, ILogDestination destination) { _source = source; _destination = destination; }
/// <summary> /// .ctor for the Collector /// </summary> /// <param name="source">The source of the Collector.</param> /// <param name="destination">The destination for the collector.</param> /// <param name="logger">The logger.</param> public Collector(ILogSource source, ILogDestination destination, ILogger <Collector> logger) { _source = source; _destination = destination; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public ChinaStatsCollector(ILogSource source, ILogDestination destination) : base(source, destination) { }
/// <summary> /// Starts a new scope, that can be stopped by disposing the returned instance /// </summary> /// <param name="log">The log target</param> /// <param name="filter">The log filter</param> /// <returns>The new scope.</returns> public static IDisposable StartScope(ILogDestination log, ILogFilter filter = null, bool isolating = false) { return(new LogScope(log, filter, CurrentScope, isolating)); }
public bool AddDestination(ILogDestination destination) { return destinations.Add(destination); }
/// <summary> /// Starts a new scope, that can be stopped by disposing the returned instance /// </summary> /// <param name="log">The log target</param> /// <param name="filter">The log filter</param> /// <returns>The new scope.</returns> public static IDisposable StartScope(ILogDestination log, ILogFilter filter = null) { return(new LogScope(log, filter, CurrentScope)); }
public bool RemoveDestination(ILogDestination destination) { return destinations.Remove(destination); }
public void SetUp() { _mock = new Mock <ILogDestination>(); _logDestination = _mock.Object; }
public void RemoveLogDestination(ILogDestination logDestination) { //ignore }
public ChinaStatsCollector(ILogSource source, ILogDestination destination, ILogger <ChinaStatsCollector> logger) : base(source, destination, logger) { }
public Logger(LogLevel level, ILogDestination destination) { Destination = destination; Level = level; }
public void WriteMessage(string message, LogType logType, ILogDestination logDestination) { logDestination.WriteLog(message, logType, typesThatCanBeLogged()); }