Here's the situation, my crate custom-log
use slog
as a dependency.
[package]
name = "custom_log"
[dependencies]
slog = { version = "2.5.2" }
And I want to change the logging level by using features with custom-log
which means that if any package set the features with custom_log
, I want to custom_log
pass the feature to slog
.
I tried to rename the name of dependency with slog
:
[features]
default = ["slog"]
debug = ["slog_debug"]
[dependencies]
slog = { version = "2.5.2", optional = true }
slog_debug = { package = "slog", version = "2.5.2", features = ["max_level_debug", "release_max_level_debug"], optional = true }
But I got the error below:
error: the crate `custom_log v0.1.1 ` depends on crate `slog v2.5.2` multiple times with different names
So I know that Cargo forbids duplicate references to a package.
Is there any recommended way to do this?