serilog / serilog-expressions

An embeddable mini-language for filtering, enriching, and formatting Serilog events, ideal for use with JSON or XML configuration.
Apache License 2.0
193 stars 17 forks source link

Disable theming when console output is redirected #40

Closed nblumhardt closed 3 years ago

nblumhardt commented 3 years ago

This employs the same approach that Serilog.Sinks.Console uses: if either STDOUT or STDERR is redirected, disable theming.

It would be nicer to be precise and only disable theming when writing to a redirected stream, but the interface between the console sink and expression template doesn't allow us to sniff for it (the template only sees the output as a buffering StringWriter).

Fixes #39