Skip to content

Commit 61fb022

Browse files
committed
Changed logging logic to fix #81
1 parent c736883 commit 61fb022

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "shared_memory"
33
description = "A user friendly crate that allows you to share memory between processes"
4-
version = "0.12.2"
4+
version = "0.12.3"
55
authors = ["ElasT0ny <elast0ny00@gmail.com>"]
66
license = "MIT OR Apache-2.0"
77
edition = "2018"
@@ -22,7 +22,8 @@ categories = [
2222
exclude = ["ci/*", ".github/*"]
2323

2424
[features]
25-
default = ["log/release_max_level_off"]
25+
default = []
26+
logging = ["log"]
2627

2728
[dependencies]
2829
cfg-if = "1.0"

src/lib.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,22 @@ use std::fs::remove_file;
99
use std::path::{Path, PathBuf};
1010

1111
use cfg_if::cfg_if;
12-
use log::*;
12+
13+
#[cfg(feature = "logging")]
14+
pub use log;
15+
#[cfg(not(feature = "logging"))]
16+
#[allow(unused_macros)]
17+
mod log {
18+
macro_rules! trace (($($tt:tt)*) => {{}});
19+
macro_rules! debug (($($tt:tt)*) => {{}});
20+
macro_rules! info (($($tt:tt)*) => {{}});
21+
macro_rules! warn (($($tt:tt)*) => {{}});
22+
macro_rules! error (($($tt:tt)*) => {{}});
23+
24+
pub(crate) use {debug, trace};
25+
}
26+
27+
use crate::log::*;
1328

1429
mod error;
1530
pub use error::*;

src/unix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::os::unix::io::RawFd;
22
use std::ptr::null_mut;
33

4-
use log::*;
4+
use cargo::log::*;
55
use nix::fcntl::OFlag;
66
use nix::sys::mman::{mmap, munmap, shm_open, shm_unlink, MapFlags, ProtFlags};
77
use nix::sys::stat::{fstat, Mode};

src/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::os::windows::{fs::OpenOptionsExt, io::AsRawHandle};
44
use std::path::PathBuf;
55
use std::ptr::null_mut;
66

7-
use log::*;
7+
use crate::log::*;
88
use win_sys::*;
99

1010
use crate::ShmemError;

0 commit comments

Comments
 (0)