public static void PublishEvent(this ILogger sender, LevelType lvl, string message) { string type = sender.GetType().ToString().Split('.').LastOrDefault(); LogMessageEventArgs lmea = new LogMessageEventArgs { Level = lvl, Message = $"{type} - {message}" }; LoggingEventHandler handler = sender.LoggingEventHandler; handler?.Invoke(sender, lmea); }
/// <summary> /// Initialises a new instance of the <see cref="Bus"/> class. /// </summary> /// <param name="hostAddress">The address this service bus can be reached.</param> /// <param name="transporter">The protocol to use to communicate with other <see cref="IServiceBus"/>es.</param> /// <param name="queueManager">The message persistence service to use.</param> /// <param name="log">The <see cref="log4net.ILog"/> to use with this service bus instance.</param> internal Bus(Uri hostAddress, ITransporter transporter, IQueueManager queueManager, ILog log) { this._disposed = false; this.PeerAddress = hostAddress; this._transport = transporter; this._queueManager = queueManager; this._messageRouter = new MessageRouter(this._queueManager, this); this._logger = log; this._loggingEventHandler = new LoggingEventHandler(this); this.RegisterSystemMessages(); this.RegisterSystemEventHandlers(); this.RegisterInternalEvents(); }
public void AddLoggingLink(LoggingEventHandler function) { _log += function; }