/// <inheritdoc /> public void Emit(LogEvent logEvent) { if (logEvent.Level < _configuration.RestrictedToMinimumLevel) { return; } var severity = ConvertLevelToSeverity(logEvent.Level); var category = _resolveCategory(logEvent); var details = _resolveDetails?.Invoke(logEvent); var sourceProvider = _configuration.IncludeCallLocation ? new SerilogMessageSourceProvider(logEvent, 2, false) : null; // We pass a null for the user name so that Log.WriteMessage() will figure it out for itself. Log.WriteMessage(severity, LogWriteMode.Queued, "Serilog", category, sourceProvider, null, logEvent.Exception, details, null, logEvent.RenderMessage(_formatProvider)); //write all in the description so Loupe wil do its own splitting. }
/// <summary> /// Create a new Loupe Sink for Serilog that will manage the Loupe session directly. /// </summary> /// <param name="loupeConfiguration">The configuration for the Loupe Agent itself</param> /// <param name="sinkConfiguration">The configuration for the sink</param> /// <param name="formatProvider">Optional. A format provider.</param> /// <remarks>This constructor will start a Loupe session with the provided configuration and /// will end the Loupe session when the sink is disposed. It's recommended to use the /// <see cref="LoupeExtensions.Loupe"/> extension method instead of directly creating this sink.</remarks> public LoupeSink(AgentConfiguration loupeConfiguration, LoupeConfiguration sinkConfiguration, IFormatProvider formatProvider = null) : this(sinkConfiguration, formatProvider) { Log.Initialize(loupeConfiguration); }