Skip to content

Compile error for golang ECS logging #3037

@liu-xiao-guo

Description

@liu-xiao-guo

At the link https://www.elastic.co/guide/en/ecs-logging/go-zerolog/current/setup.html, I run the example code:

// Add custom fields.
log.Info().Msg("hello world").Str("custom", "foo")

it gives me the following error:

log.Info().Msg("hello world") (no value) used as value or type

I need to change it to:

log.Info().Str("custom", "foo").Msg("Hello, World!")
to make it work by referring https://github.com/rs/zerolog

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