sile / sloggers

A Rust library which provides frequently used slog loggers and convenient functions
MIT License
37 stars 18 forks source link

Add more ways to display module information #26

Closed Emilgardis closed 4 years ago

Emilgardis commented 4 years ago

This PR adds some more ways to output log invocation site.

I would not recommend this for usage in releases, but for local development it's very handy to be able to use something like VSCode ctrl clicking on file:line to go to that location in file.

FileAndLine

Produces

"module" => "/path/to/bla/that/may/be/relative/or/not.rs:7"

LocalFileAndLine

This produces for logs where std::file!() reported with a relative path, e.g when log is made by workspace member

"module" => "my_crate/src/lib.rs:42"

and else

"module" => "foo_crate::module::bar:101"

Note

One thing to think about is if still calling it module is appropriate, maybe calling the key "file" is more appropriate?

sile commented 4 years ago

Published: v0.3.6