Skip to content

Custom ITextFormatter BodyFormatter for log message bodies #134

Open
@DevProJSSV

Description

@DevProJSSV

Hello team,

I am trying to find a way to format otlp logs when using the opentelemetry sink :

Log.Logger = new LoggerConfiguration()
    .WriteTo.OpenTelemetry(options =>
    {
        options.Endpoint = "http://127.0.0.1:4317";
        options.ResourceAttributes = new Dictionary<string, object>
        {
            ["service.name"] = "test-logging-service",
            ["index"] = 10,
            ["flag"] = true,
            ["value"] = 3.14
        };
        options.Format=json;   -------- > # Something like this
    })
    .CreateLogger();

I know there is a way to do it with.WriteTo.Console() bust as I am leveraging otlp communication I would like to send all structured in Json using WriteTo.OpenTelemetry().

May you recommend me any approach?. Thank you in advance @nblumhardt

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions