Skip to content

[BUG] GLib structured logger duplicates CODE_FILE, CODE_LINE, and CODE_FUNC #1537

@swsnr

Description

@swsnr

Bug description

When GLibLoggerFormat::Structured is used, the Log::log implementation of GLibLogger calls GlibLogger::write_log_structured, passing the log record's file, line, and module_path as line, file, and function name respectively.

GlibLogger::write_log_structured then calls log_structured!, passing the line, file, and function name as the CODE_FILE, CODE_LINE and CODE_FUNC fields respectively.

However, the log_structured! then again adds CODE_FILE, CODE_LINE, and CODE_FUNC, using the values of file!(), line!(), and a custom function_name!() respectively.

Hence, any log event from the structured logger ends up with duplicated CODE_* fields, where the duplicates always reference the GLibLogger::write_log_structured call site.

Is this intended behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions