[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 chelseakomlo):
Ok, see the merge request on gitlab here:
https://oniongit.eu/network/tor/merge_requests/7
This PR creates a minimal implementation for Rust modules to log using
tor's existing logger.
One issue that I ran into is that log levels/domains are defined as macros
in C. I redeclared a small subset of these as constants- if this is the
approach that we want to take, I can fill out the remainder of necessary
constants. Another alternative is to define log level/log domain macros as
constants in C.
In order to run module-level Rust tests without linking to C, it is
necessary to "stub" out direct calls to C functions. This PR adds a
"testing" feature in order to optionally compile no-op implementations for
testing. (The approach of "write C integration tests and test Rust in
isolation" is an approach taken by Servo, although it would be great to
get Rust people's eyes on this to double check how I've done this).
Looking forward to feedback and suggestions how to improve!
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23881#comment:8>
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