This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Serilog; | |
using Serilog.Configuration; | |
using Serilog.Core; | |
using Serilog.Events; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Text.Json; | |
using Serilog.Core; | |
using Serilog.Events; | |
class JsonDocumentDestructuringPolicy : IDestructuringPolicy | |
{ | |
public bool TryDestructure(object value, ILogEventPropertyValueFactory _, out LogEventPropertyValue result) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Serilog.Core; | |
using Serilog.Events; | |
// .Enrich.With(new OperationIdEnricher()) | |
class OperationIdEnricher : ILogEventEnricher | |
{ | |
public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) | |
{ | |
if (logEvent.Properties.TryGetValue("RequestId", out var requestId)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using Serilog; | |
using Serilog.Configuration; | |
using Serilog.Core; | |
using Serilog.Events; | |
namespace ConsoleApp24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using Serilog.Configuration; | |
using Serilog.Core; | |
using Serilog.Events; | |
namespace Serilog.Sinks.Map | |
{ | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Needs to be sent to Seq with the ?clef flag, e.g. /api/events/raw?clef | |
// | |
// See also: | |
// https://github.com/serilog/serilog-formatting-compact#reified-properties | |
{"@t":"...","@mt":"The {Item} cost ${Amount:0.00}","Item":"apple","Amount":3.2,"@r":["3.20"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install-Package Seq.Api -Pre | |
Install-Package Serilog.Formatting.Compact.Reader -Pre | |
Install-Package Serilog.Sinks.Literate | |
Install-Package System.Reactive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using MessageTemplates.Core; | |
using MessageTemplates.Parsing; | |
using MessageTemplates.Structure; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
namespace MessageTemplateRenderer | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste into Settings > Theme, <refresh> | |
.masthead h1:after { | |
content: 'PRODUCTION'; | |
position: absolute; | |
top: 10px; | |
left: 110px; | |
color: white; | |
opacity: 0.4; | |
font-size: 16px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Serilog.Events; | |
namespace SerilogStructuredDataToolkit | |
{ | |
public abstract class LogEventPropertyValueVisitor<TResult> | |
{ | |
public virtual TResult Visit(LogEventPropertyValue value) |
NewerOlder