Skip to content

Can't colorize timestamp component of log format string #85

@fourpastmidnight

Description

@fourpastmidnight

Does this issue relate to a new feature or an existing bug?

  • Bug
  • New Feature

Not sure that this is a "bug" per se, it may be considered a missing "feature".

What version of Serilog Console Sink is affected by this issue? Please list the related NuGet package.

v3.1.1

What is the target framework and operating system affected by this issue? Please see target frameworks & net standard matrix.

  • netCore 3.1
  • netCore 2.0
  • netCore 1.0
  • 4.7
  • 4.6.x
  • 4.5.x

Please describe the current behaviour you are experiencing?

I created a custom ANSI color theme. I noticed that the timestamp component of the output template format string was not colorized. I tried the following:

{
  "Serilog": {
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "theme": "Full Qualified Class Name of my theme",
          "outputTemplate": "[\u001b[38;2;104;153;106m{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{Newline}{Exception}"
        }
      }
    ]
  }
}

Please describe the expected behaviour if the ?

I expected that the timestamp component would be come an aqua green color (from Gruvbox Dark). Instead, the timestamp component remained the standard default terminal text color.

Suggested way to fix/add feature

Perhaps a new ConsoleThemeStyle field could be added: Timestamp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions