Vostok.Logging
HomeQuickstartModulesImplementations
1.0.0
1.0.0
  • Home
  • Quickstart
  • Guarantees
  • Configuration
  • Concepts and basics
    • Log interface
    • Log events
    • Syntax
      • Logging extensions
      • Message templates
      • Providing property values
    • Formatting
      • Output templates
      • Special properties
      • Format specifiers
    • Source context
    • Operation context
  • Modules
    • Abstractions
    • Configuration
    • Formatting
    • Console
    • File
    • Hercules
    • Context
    • Serilog
    • Log4net
    • NUnit
    • Microsoft
  • Implementations
    • Silent log
    • Console log
    • File log
    • Hercules log
  • Integrations
    • Serilog integration
    • Log4net integration
    • Microsoft logging integration
  • How-to guides
    • Using operation context
    • Using static log provider
    • Filtering events
    • Enriching events
    • Transforming events
    • Combining multiple logs
    • Custom output templates
    • External configuration rules
Powered by GitBook
On this page
  1. Concepts and basics
  2. Syntax

Message templates

Message template is the text of a log message that can potentially contain placeholders filled with property values during rendering.

Placeholders are always specified in curly brackets: Response code = {Code}.

During rendering, placeholders are replaced with values of properties with corresponding names:

Response code = {Code} + {"Code": "200"} = Response code = 200

Any mismatched brackets are kept as-is: {key} template renders to the same text.

Any placeholders without corresponding properties are replaced with empty strings.

Double curly brackets can be used to escape occurrences of curly brackets in text: {{key}} template renders to {key} text.

Do not pass a message as a message template.

For example, instead of log.Info(json) you should use log.Info("{Json}", json).

Otherwise, you may have performance issues (due to the internal templates cache) or corrupted messages (due to the rendering stage).

PreviousLogging extensionsNextProviding property values

Last updated 2 years ago