aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2018-09-25 18:49:09 +0200
committerTeddy Wing2018-09-25 18:49:09 +0200
commit9a63974bbfed1f5f9da53c19551a127eedab967d (patch)
treedce5ad832f92d3ce05b4bd5b1e30e0e53a073535 /src
parent0ec3b951795b04359ddc99ef9199a45a9b60bf03 (diff)
downloaddome-key-map-9a63974bbfed1f5f9da53c19551a127eedab967d.tar.bz2
Add `logger_init()` to init 'stderrlog'
Trying to see if this works. If I call the init function over FFI and then call functions that use the error macro, will logging work?
Diffstat (limited to 'src')
-rw-r--r--src/cocoa_bridge.rs6
-rw-r--r--src/lib.rs1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
index 5c7c40d..189d504 100644
--- a/src/cocoa_bridge.rs
+++ b/src/cocoa_bridge.rs
@@ -8,6 +8,7 @@ use autopilot::key::type_string;
// use cocoa::base::nil;
// use cocoa::foundation::{NSArray, NSAutoreleasePool, NSDictionary};
use libc::{c_char, size_t};
+use stderrlog;
use xdg;
use {HeadphoneButton, MapGroup, MapKind};
@@ -102,6 +103,11 @@ pub struct State {
}
#[no_mangle]
+pub extern "C" fn logger_init() {
+ stderrlog::new().module(module_path!()).init().unwrap();
+}
+
+#[no_mangle]
pub extern "C" fn state_new() -> *mut State {
Box::into_raw(Box::new(State::default()))
}
diff --git a/src/lib.rs b/src/lib.rs
index 13d70e8..795d1d9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,6 +7,7 @@ extern crate libc;
#[macro_use]
extern crate log;
+extern crate stderrlog;
extern crate xdg;
mod cocoa_bridge;