Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ hashbrown = { version = "0.15", optional = true }
parking_lot = { version = "0.12", optional = true }
regex = { version = "1.12.3", optional = true }
vec64 = { version = "0.4.7" }
log = "0.4.29"
log = { version = "0.4.29", optional = true }

[dev-dependencies]
criterion = { version = "0.8.2", features = ["html_reports"] }
Expand All @@ -65,6 +65,9 @@ libc = "0.2"

[features]

# Enables logging output via the log crate. When disabled, warnings fall back to eprintln!
log = ["dep:log"]

# Adds parallel iterators via `Rayon`
parallel_proc = ["rayon"]

Expand Down Expand Up @@ -312,6 +315,7 @@ default = [
"large_string",
"simd",
"select",
"log"
]

[package.metadata.cargo-all-features]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ pub mod traits {

pub mod aliases;
pub mod conversions;
pub mod log;
pub mod macros;
pub mod utils;

Expand Down
14 changes: 14 additions & 0 deletions src/log.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Conditional logging support: uses log crate when enabled, eprintln fallback when disabled.

#[cfg(feature = "log")]
pub use log::warn;

#[cfg(not(feature = "log"))]
macro_rules! warn_fallback {
($($arg:tt)*) => {
eprintln!($($arg)*)
};
}

#[cfg(not(feature = "log"))]
pub(crate) use warn_fallback as warn;
2 changes: 1 addition & 1 deletion src/structs/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ use std::fmt::{Display, Formatter};
use std::ops::{Deref, DerefMut, RangeBounds};
use std::{fmt, mem};

use log::warn;
use crate::log::warn;

use crate::Vec64;
#[cfg(feature = "lbuffer")]
Expand Down
2 changes: 1 addition & 1 deletion src/structs/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};

#[cfg(feature = "cast_arrow")]
use arrow::array::RecordBatch;
use log::warn;
use crate::log::warn;
#[cfg(feature = "cast_polars")]
use polars::frame::DataFrame;
#[cfg(feature = "cast_polars")]
Expand Down
Loading