aboutsummaryrefslogtreecommitdiff
path: root/src/rust/tor_util
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-03-19 17:20:37 -0400
committerNick Mathewson <nickm@torproject.org>2018-03-19 17:20:37 -0400
commitd8893bc93c52e1edd0a76b81f5d65bb10d790474 (patch)
treef6bb243d9fbeb179c7a5a3a79a19752ba970c98e /src/rust/tor_util
parent3716611fea1c400e80ab3cfd19c588e32b1c005c (diff)
parent1f8bd93ecbb57eb47c5788f4a4d12f3bdee61b47 (diff)
downloadtor-d8893bc93c52e1edd0a76b81f5d65bb10d790474.tar.gz
tor-d8893bc93c52e1edd0a76b81f5d65bb10d790474.zip
Merge remote-tracking branch 'isis/bug23881_r1'
Diffstat (limited to 'src/rust/tor_util')
-rw-r--r--src/rust/tor_util/Cargo.toml3
-rw-r--r--src/rust/tor_util/ffi.rs13
-rw-r--r--src/rust/tor_util/lib.rs3
3 files changed, 13 insertions, 6 deletions
diff --git a/src/rust/tor_util/Cargo.toml b/src/rust/tor_util/Cargo.toml
index d7379a5988..adc3390b53 100644
--- a/src/rust/tor_util/Cargo.toml
+++ b/src/rust/tor_util/Cargo.toml
@@ -11,6 +11,9 @@ crate_type = ["rlib", "staticlib"]
[dependencies.tor_allocate]
path = "../tor_allocate"
+[dependencies.tor_log]
+path = "../tor_log"
+
[dependencies]
libc = "0.2.22"
diff --git a/src/rust/tor_util/ffi.rs b/src/rust/tor_util/ffi.rs
index 5c3cdba4be..32779ed476 100644
--- a/src/rust/tor_util/ffi.rs
+++ b/src/rust/tor_util/ffi.rs
@@ -5,8 +5,7 @@
//! called from C.
//!
-use libc::c_char;
-use tor_allocate::allocate_and_copy_string;
+use tor_log::{LogSeverity, LogDomain};
/// Returns a short string to announce Rust support during startup.
///
@@ -17,10 +16,12 @@ use tor_allocate::allocate_and_copy_string;
/// tor_free(rust_str);
/// ```
#[no_mangle]
-pub extern "C" fn rust_welcome_string() -> *mut c_char {
- let rust_welcome = String::from(
+pub extern "C" fn rust_log_welcome_string() {
+ tor_log_msg!(
+ LogSeverity::Notice,
+ LogDomain::General,
+ "rust_log_welcome_string",
"Tor is running with Rust integration. Please report \
- any bugs you encounter.",
+ any bugs you encounter."
);
- allocate_and_copy_string(&rust_welcome)
}
diff --git a/src/rust/tor_util/lib.rs b/src/rust/tor_util/lib.rs
index 12cb3896b6..94697b6069 100644
--- a/src/rust/tor_util/lib.rs
+++ b/src/rust/tor_util/lib.rs
@@ -7,5 +7,8 @@
extern crate libc;
extern crate tor_allocate;
+#[macro_use]
+extern crate tor_log;
+
pub mod ffi;
pub mod strings;