Skip to content

Accept an IFormatProvider #150

Description

@taspeotis

I'd like to render a currency value in my log output. For the sake of discussion:

decimal currentBalance = 12345.67M;

Log.Logger.Information("Your balance is {CurrentBalance:C}", currentBalance);

As best I can tell Seq uses the invariant culture which renders currencies like ¤12,345.67 (or (¤12,345.67) for negative). I sympathise with the choice of invariant culture as a good default but its currency format is not very native to me.

Serilog's documentation suggests the onus is on sinks to support format providers, and I can't see any way to give Seq a CustomDecimalFormatter or similar.

For now I am using {CurrentBalance:$#,0.00} as a workaround, I'd prefer to use C and get a en-AU/en-US style currency.

If I've overlooked how to specify a format provider for this sink please let me know, otherwise I submit "Specify Format Provider" as a feature request for your consideration.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions