[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



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

Comment (by nickm):

 So my first thought is to take this approach:
    * Refactor the C a bit, though, so that there is a tor_log_string()
 function taking a severity, domain, and message.  It should work the same
 as `tor_log(severity, domain, message);`, but instead it should be safe to
 call it function with strings containing `%`.  (I can write this one if
 you want: it will involve refactoring `logv` a little.
    * Expose that function to rust.
    * Write a single rust macro that takes severity, domain, message, and
 some format arguments, and uses the `format!` mechanism to generate the
 log message.

 Optionally afterwards:
    * Expose a view of `log_global_min_severity` to rust, maybe via a
 function.
    * Update the rust macro to compare `log_global_min_severity` to the
 declared severity, and avoid formatting the message if no logs actually
 want it.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23881#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs