/// <summary> /// Formats message. /// </summary> /// <param name="fileWatcherRecycledEventArgs">Message.</param> /// <returns>Formatted message.</returns> /// <exception cref="ArgumentNullException">fileWatcherRecycledEventArgs is null.</exception> public string Format(FileWatcherRecycledEventArgs fileWatcherRecycledEventArgs) { if (fileWatcherRecycledEventArgs == null) { throw new ArgumentNullException("fileWatcherRecycledEventArgs", Resources.ArgumentNullException); } string recycleReason = String.Empty; if (fileWatcherRecycledEventArgs.Reason == RecycleReason.DirectoryNotFound) { recycleReason = Resources.MessageFileWatcherRecycleReasonDirectoryNotFound; } else if (fileWatcherRecycledEventArgs.Reason == RecycleReason.Error) { recycleReason = Resources.MessageFileWatcherRecycleReasonError; } else if (fileWatcherRecycledEventArgs.Reason == RecycleReason.Recycle) { recycleReason = Resources.MessageFileWatcherRecycleReasonRecycle; } return(String.Format(CultureInfo.CurrentCulture, @Resources.MessageFileWatcherRecycle, @DateTime.Now, @Resources.MessageTypeInfo, @fileWatcherRecycledEventArgs.DaemonName, @recycleReason)); }
/// <summary> /// Handles file watcher recycle event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Event data.</param> protected virtual void OnFileWatcherRecycle(object sender, FileWatcherRecycledEventArgs e) { AddLogMessage(_formatter.Format(e)); }
/// <summary> /// Handles file watcher recycle event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Event data.</param> protected virtual void OnFileWatcherRecycle(object sender, FileWatcherRecycledEventArgs e) { _logger.Log(_formatter.Format(e)); }