Skip to content

Commit

Permalink
fix: use better log location
Browse files Browse the repository at this point in the history
  • Loading branch information
tobii-dev committed Sep 26, 2023
1 parent 39b9ee8 commit e1999a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ name = "blur-lua-loader"
version = "0.1.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "lua_hooks"
crate-type = ["cdylib"]


[dependencies]
blur-plugins-core = { git = "https://github.com/tobii-dev/blur-plugins-core" }
colored = "2.0.4"
cstr = "0.2.11"

log = { version = "0.4.20", features = ["release_max_level_info"] }
log-panics = { version = "2.1.0", features = ["with-backtrace"] }
mlua-sys = { version = "0.3.2", features = ["lua51", "module"] }
simplelog = "0.12.1"
colored = "2.0.4"
cstr = "0.2.11"

mlua-sys = { version = "0.3.2", features = ["lua51", "module"] }
windows = { version = "0.51.1", features = ["Win32_Foundation", "Win32_System_Memory", "Win32_System_LibraryLoader"] }
1 change: 1 addition & 0 deletions src/hook/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ pub unsafe extern "C-unwind" fn notify(s: *mut lua_State) -> c_int {

if let Some(blur_api) = &mut crate::API {
// FIXME: this makes no sense right now.
#[rustfmt::skip]
let notif = match n {
0 => BlurNotification::Nothing,
1 => BlurNotification::LoginStart,
Expand Down
11 changes: 4 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ impl BlurPlugin for MyLuaHooksPlugin {
"LuaHooksPlugin"
}

fn on_event(&self, _event: &BlurEvent) { }
fn on_event(&self, _event: &BlurEvent) {}

fn free(&self) { }
fn free(&self) {}
}

#[no_mangle]
fn plugin_init(api: &'static mut dyn BlurAPI) -> Box<dyn BlurPlugin> {
//SAFETY: Not really; api shouldn't even be &'static
//SAFETY: Nah
unsafe { API = Some(Box::new(api)) }

let plugin = MyLuaHooksPlugin {};
Expand All @@ -37,10 +37,7 @@ fn plugin_init(api: &'static mut dyn BlurAPI) -> Box<dyn BlurPlugin> {
.set_time_offset_to_local()
.unwrap()
.build();
let log_path = std::format!(".\\amax\\log\\{}.log", plugin.name());
let log_file = std::fs::File::create(&log_path).unwrap_or_else(|_| {
panic!("Couldn't create log file: {log_path}");
});
let log_file = blur_plugins_core::create_log_file("lua_hooks.log").unwrap();
CombinedLogger::init(vec![
TermLogger::new(
LevelFilter::Trace,
Expand Down

0 comments on commit e1999a5

Please sign in to comment.