commit 5f8aebaea948433a8daa33a6c86eccbf321eaa47
parent 3c73d4179b75afa886d59cf5d9d3edca081ad15b
Author: lash <dev@holbrook.no>
Date: Sun, 28 Jul 2024 19:51:05 +0100
Remove pointless logg abstraction
Diffstat:
7 files changed, 9 insertions(+), 168 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -145,9 +145,10 @@ dependencies = [
"atom_syndication",
"chrono",
"digest",
- "feed-rs",
+ "env_logger",
"http",
"itertools",
+ "log",
"rs_sha512",
"rss",
"serde",
@@ -288,38 +289,12 @@ dependencies = [
]
[[package]]
-name = "feed-rs"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c546f6f85e02eaca09e6a6dd22fe4db839745f55ae16c8f36626980a57f5bc4"
-dependencies = [
- "chrono",
- "mediatype",
- "quick-xml 0.36.1",
- "regex",
- "serde",
- "serde_json",
- "siphasher",
- "url",
- "uuid",
-]
-
-[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
-name = "form_urlencoded"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
-dependencies = [
- "percent-encoding",
-]
-
-[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -396,16 +371,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
-name = "idna"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
-dependencies = [
- "unicode-bidi",
- "unicode-normalization",
-]
-
-[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -442,12 +407,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
-name = "mediatype"
-version = "0.19.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8878cd8d1b3c8c8ae4b2ba0a36652b7cf192f618a599a7fbdfa25cffd4ea72dd"
-
-[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -475,12 +434,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
-name = "percent-encoding"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
-
-[[package]]
name = "proc-macro2"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -510,16 +463,6 @@ dependencies = [
]
[[package]]
-name = "quick-xml"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "96a05e2e8efddfa51a84ca47cec303fac86c8541b686d37cac5efc0e094417bc"
-dependencies = [
- "encoding_rs",
- "memchr",
-]
-
-[[package]]
name = "quote"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -618,12 +561,6 @@ dependencies = [
]
[[package]]
-name = "ryu"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
-
-[[package]]
name = "serde"
version = "1.0.204"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -644,23 +581,6 @@ dependencies = [
]
[[package]]
-name = "serde_json"
-version = "1.0.120"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
-dependencies = [
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "siphasher"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
-
-[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -702,65 +622,24 @@ dependencies = [
]
[[package]]
-name = "tinyvec"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
-
-[[package]]
name = "typenum"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
-name = "unicode-bidi"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
-
-[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
-name = "unicode-normalization"
-version = "0.1.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
-dependencies = [
- "tinyvec",
-]
-
-[[package]]
name = "unicode-width"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
[[package]]
-name = "url"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
-dependencies = [
- "form_urlencoded",
- "idna",
- "percent-encoding",
-]
-
-[[package]]
name = "uuid"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
@@ -8,18 +8,10 @@ authors = ["Louis Holbrook <dev@holbrook.no>"]
[dependencies]
clap = "2.34.0"
crier = { path = "./crier-lib", features = ["fs"] }
+log = "^0.4"
+env_logger = "^0.9"
-[dependencies.env_logger]
-version = "^0.9"
-optional = true
-
-[dependencies.log]
-version = "^0.4"
-optional = true
[patch.crates-io]
#atom_syndication = { path = "/home/lash/src/contrib/atom_syndication" }
atom_syndication = { git = "git://holbrook.no/contrib/atom_syndication", rev="9985c1610b2b819f5bd2f7a719567ee0b5419b85" } #branch="lash/entry-fromstr"
-
-[features]
-logging = ["log", "env_logger"]
diff --git a/crier-lib/Cargo.toml b/crier-lib/Cargo.toml
@@ -15,6 +15,8 @@ chrono = "^0.4"
itertools = "^0.13"
serde = "^1.0"
atom_syndication = "^0.12"
+log = "^0.4"
+env_logger = "^0.9"
[dependencies.uuid]
version = "^1.9"
@@ -32,14 +34,6 @@ tempfile = "3.3.0"
mediatype = "^0.19"
quick-xml = "^0.31"
-[dependencies.env_logger]
-version = "^0.9"
-optional = true
-
-[dependencies.log]
-version = "^0.4"
-optional = true
[features]
fs = []
-logging = ["log", "env_logger"]
diff --git a/crier-lib/src/lib.rs b/crier-lib/src/lib.rs
@@ -26,7 +26,6 @@ pub mod mem;
mod meta;
mod cache;
mod rss;
-mod log;
use meta::FeedMetadata;
use mem::CacheWriter;
use cache::Cache;
diff --git a/crier-lib/src/log.rs b/crier-lib/src/log.rs
@@ -1,21 +0,0 @@
-#[cfg(feature = "logging")]
-use env_logger;
-pub use log::debug;
-pub use log::info;
-
-pub fn init() {
- env_logger::init();
-}
-
-#[cfg(not(feature = "logging"))]
-#[macro_export]
-macro_rules! info {
- (*) => {};
-}
-
-#[cfg(not(feature = "logging"))]
-#[macro_export]
-macro_rules! debug {
- (*) => {};
-}
-
diff --git a/crier-lib/src/rss.rs b/crier-lib/src/rss.rs
@@ -3,9 +3,9 @@ use std::fs::File;
use std::io::BufReader;
use std::io::BufRead;
use crate::Error;
-use crate::log::info;
-use crate::log::debug;
+use log::info;
+use log::debug;
use rss::Channel;
use rss::Item;
use rss::extension::dublincore::DublinCoreExtension;
@@ -173,7 +173,7 @@ pub fn from_file(fp: &str, allow_entry_fail: bool) -> Result<Feed, Error> {
mod test {
use std::path::Path;
use atom_syndication::Feed;
- use crate::log;
+ use env_logger;
#[test]
fn test_rss_from_file() {
diff --git a/src/main.rs b/src/main.rs
@@ -7,7 +7,6 @@ use std::str::from_utf8;
use clap::Arg;
use clap::App;
-#[cfg(feature="logging")]
use log::debug;
use log::info;
use env_logger;
@@ -90,7 +89,6 @@ fn main() {
seq.set_author("Foo Bar");
-#[cfg(feature = "logging")]
env_logger::init();
debug!("config has {} uris", cfg.urls.len());