Skip to content

Custom File and Line Overwriting #2419

@gluax

Description

@gluax

Feature Request

This may already exist, but I could not find any documentation or examples on it, but please feel free to point me in the right direction if I'm wrong.

Crates

N/A

Motivation

I've been working with wasm a lot lately, specifically using the wasmer and wasmer-wasi. I have a use case where the logging function is written from the rust side. Then that function is called on the wasm side. This results in always saying the file and line are from the rust side. I'd love to be able to overwrite the level and line easily just by passing it to a macro.

Proposal

Something like tracing::debug!(message, line = 32, file = "wasm_bins/foo/main.rs") would be great.

Alternatives

I'm not super familiar with the internals of tracing; there may be better ways to do this.

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