Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Serilog Syntax Highlighting
Serilog Syntax Highlighting

Serilog Syntax Highlighting

mtlog

|
110 installs
| (0) | Free
Provides syntax highlighting, navigation, and brace matching for Serilog message templates in C#/.NET projects. Supports all property types including standard, destructured, stringified, and positional properties.
Download

Serilog Syntax Highlighting Preview

A Visual Studio 2022 extension that provides syntax highlighting, brace matching, property-argument highlighting, and navigation features for Serilog message templates in C#/.NET projects.

Features

🎨 Syntax Highlighting

  • Automatic theme-aware colors - automatically switches between Light and Dark Visual Studio themes
  • WCAG AA compliant - all colors maintain ≥4.5:1 contrast ratio for accessibility
  • Property names highlighted in blue: {UserId}, {UserName}
  • Destructuring operator @ highlighted in orange: {@User}
  • Stringification operator $ highlighted in orange: {$Settings}
  • Format specifiers highlighted in green: {Timestamp:yyyy-MM-dd}
  • Alignment highlighted in red: {Name,10}, {Price,-8}
  • Positional parameters highlighted in purple: {0}, {1}
  • Property braces highlighted in gray for structure
  • Multi-line verbatim strings fully supported with proper highlighting across lines
  • C# 11 raw string literals supported with """ delimiters for complex templates

🔦 Property-Argument Highlighting

  • Interactive highlighting of property-argument connections
  • When cursor is on a template property (e.g., {UserId}), both the property and its corresponding argument are highlighted
  • When cursor is on an argument, both the argument and its template property are highlighted
  • Works across all string literal types (regular, verbatim @"...", raw """...""""")
  • Handles complex scenarios including multi-line templates, collection expressions, and anonymous objects
  • Press ESC to dismiss highlights

✨ Serilog.Expressions Support

  • Filter expressions in Filter.ByExcluding() and Filter.ByIncludingOnly()
  • Expression templates with control flow directives ({#if}, {#each}, {#else}, {#end})
  • Operators highlighted distinctly: and, or, not, like, in, is null
  • Functions highlighted: StartsWith(), Contains(), Length(), etc.
  • Built-in properties: @t, @m, @l, @x, @i, @p
  • Computed properties in Enrich.WithComputed()
  • Conditional writes in WriteTo.Conditional()

🔗 Navigation

  • Navigate from template properties to their corresponding arguments
  • Light bulb suggestions when hovering over properties

🔍 Brace Matching

  • Highlight matching braces when cursor is positioned on { or }
  • Visual indication of brace pairs in complex templates
  • Multi-line support - matches braces across line boundaries in verbatim and raw strings
  • Press ESC to temporarily dismiss highlights
  • Helps identify mismatched or nested braces

Supported Serilog Syntax

Works with all Serilog logging methods including:

  • Direct Serilog calls: Log.Information(), Log.Debug(), etc.
  • ILogger interface: logger.LogInformation(), logger.LogError(), etc.
  • ForContext chains: Log.ForContext<T>().Information()
  • BeginScope: logger.BeginScope("Operation={Id}", id)
  • LogError with exception: logger.LogError(ex, "Message", args)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft