Skip to content

Commit

Permalink
removed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dakyskye committed Jun 13, 2020
1 parent 60f32af commit b334f58
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 26 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ crate-type = ["cdylib"]

[dependencies]
samp = {git="https://github.com/ZOTTCE/samp-rs/",branch="async-amx",features = ["async"]}
log = "0.4.6"
fern = "0.5.7"
dotenv = "0.15.0"
dotenv = "0.15.0"
9 changes: 0 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ initialize_plugin!(
{
dotenv().ok();

samp::plugin::enable_process_tick();
let samp_logger = samp::plugin::logger().level(log::LevelFilter::Info);

let _ = fern::Dispatch::new().format(|callback, message, record| {
callback.finish(format_args!("[pawn-env] [{}]: {}", record.level().to_string().to_lowercase(), message))
})
.chain(samp_logger)
.apply();

PawnEnv {}
}
);
16 changes: 2 additions & 14 deletions src/natives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,11 @@ use samp::prelude::*;
use samp::native;
use samp::error::AmxResult;
use std::env;
use log::error;

impl super::PawnEnv {
#[native(name = "Env_Has")]
pub fn has_env(&mut self, _amx: &Amx, env_var: AmxString) -> AmxResult<bool> {
match env::var(env_var.to_string()) {
Ok(_) => {
return Ok(true);
}
Err(e) => {
if e != env::VarError::NotPresent {
error!("Env_Has \"{}\": {}", env_var.to_string(), e);
}
return Ok(false);
}
}
Ok(env::var(env_var.to_string()).is_ok())
}
#[native(name = "Env_Get")]
pub fn get_env(&mut self, _amx: &Amx, env_var: AmxString, dest: UnsizedBuffer, size: usize) -> AmxResult<bool> {
Expand All @@ -27,8 +16,7 @@ impl super::PawnEnv {
let err = samp::cell::string::put_in_buffer(&mut dest, &val);
return Ok(err.is_ok());
}
Err(e) => {
error!("Env_Get \"{}\": {}", env_var.to_string(), e);
Err(_) => {
return Ok(false);
}
}
Expand Down

0 comments on commit b334f58

Please sign in to comment.