[tor-bugs] #23881 [Core Tor/Tor]: Implement a way to utilise tor's logging system from Rust code

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Feb 28 23:20:24 UTC 2018


#23881: Implement a way to utilise tor's logging system from Rust code
-----------------------------------------------+---------------------------
 Reporter:  isis                               |          Owner:  isis
     Type:  enhancement                        |         Status:  accepted
 Priority:  High                               |      Milestone:  Tor:
                                               |  0.3.3.x-final
Component:  Core Tor/Tor                       |        Version:
 Severity:  Normal                             |     Resolution:
 Keywords:  rust, rust-pilot, review-group-29  |  Actual Points:
Parent ID:                                     |         Points:  3
 Reviewer:  nickm                              |        Sponsor:
-----------------------------------------------+---------------------------

Comment (by isis):

 Yesterday I tried to find a way to get the name of the current function
 we're being called from, so that we wouldn't have to manually type it out
 everytime we log something. It seems like there [https://github.com/rust-
 lang/rfcs/pull/1719 was a proposed RFC] to make this info available, but
 it unfortunately stalled out. One of the major logger implementation in
 Rust, slog, also [https://github.com/slog-
 rs/slog/blob/9ec2bc5286c273fe7c0df7dd29c4f23f1ef9c705/src/lib.rs#L307
 doesn't/can't log function names currently] but instead stubs it out with
 `function: ""` and logs lines/columns/filenames instead. We could maybe do
 something like what this `nameof`
 [https://github.com/SilentByte/nameof/blob/master/src/lib.rs#L37 crate is
 doing], but then we'd have to find some way to call the macro outside of
 the function that is calling the logger somehow, and I still don't really
 see a way to make it automatic. Perhaps this could be something for the
 Rust wishlist?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23881#comment:40>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list