Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep: move from derivative to educe #392

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "log4rs"
version = "1.3.0"
version = "1.3.1"
authors = ["Steven Fackler <[email protected]>", "Evan Simmons <[email protected]>"]
description = "A highly configurable multi-output logging implementation for the `log` facade"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -75,7 +75,7 @@ parking_lot = { version = "0.12.0", optional = true }
rand = { version = "0.8", optional = true}
thiserror = "1.0.15"
anyhow = "1.0.28"
derivative = "2.2"
educe = "0.6"
once_cell = "1.17.1"

[target.'cfg(windows)'.dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/append/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Requires the `console_appender` feature.

use derivative::Derivative;
use educe::Educe;
use log::Record;
use std::{
fmt,
Expand Down Expand Up @@ -117,10 +117,10 @@ impl<'a> encode::Write for WriterLock<'a> {
///
/// It supports output styling if standard out is a console buffer on Windows
/// or is a TTY on Unix.
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Educe)]
#[educe(Debug)]
pub struct ConsoleAppender {
#[derivative(Debug = "ignore")]
#[educe(Debug(ignore))]
writer: Writer,
encoder: Box<dyn Encode>,
do_write: bool,
Expand Down
8 changes: 4 additions & 4 deletions src/append/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Requires the `file_appender` feature.

use derivative::Derivative;
use educe::Educe;
use log::Record;
use parking_lot::Mutex;
use std::{
Expand Down Expand Up @@ -32,11 +32,11 @@ pub struct FileAppenderConfig {
}

/// An appender which logs to a file.
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Educe)]
#[educe(Debug)]
pub struct FileAppender {
path: PathBuf,
#[derivative(Debug = "ignore")]
#[educe(Debug = "ignore")]
file: Mutex<SimpleWriter<BufWriter<File>>>,
encoder: Box<dyn Encode>,
}
Expand Down
8 changes: 4 additions & 4 deletions src/append/rolling_file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//!
//! Requires the `rolling_file_appender` feature.

use derivative::Derivative;
use educe::Educe;
use log::Record;
use parking_lot::Mutex;
use std::{
Expand Down Expand Up @@ -151,10 +151,10 @@ impl<'a> LogFile<'a> {
}

/// An appender which archives log files in a configurable strategy.
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Educe)]
#[educe(Debug)]
pub struct RollingFileAppender {
#[derivative(Debug = "ignore")]
#[educe(Debug = "ignore")]
writer: Mutex<Option<LogWriter>>,
path: PathBuf,
append: bool,
Expand Down
8 changes: 4 additions & 4 deletions src/config/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
use std::{collections::HashMap, fmt, marker::PhantomData, sync::Arc, time::Duration};

use anyhow::anyhow;
use derivative::Derivative;
use educe::Educe;
use log::LevelFilter;
use serde::de::{self, Deserialize as SerdeDeserialize, DeserializeOwned};
use serde_value::Value;
Expand Down Expand Up @@ -438,12 +438,12 @@ where
Option::<S>::deserialize(d).map(|r| r.map(|s| s.0))
}

#[derive(Clone, Debug, Derivative, serde::Deserialize)]
#[derivative(Default)]
#[derive(Clone, Debug, Educe, serde::Deserialize)]
#[educe(Default)]
#[serde(deny_unknown_fields)]
struct Root {
#[serde(default = "root_level_default")]
#[derivative(Default(value = "root_level_default()"))]
#[educe(Default(expression = root_level_default()))]
level: LevelFilter,
#[serde(default)]
appenders: Vec<String>,
Expand Down
8 changes: 4 additions & 4 deletions src/encode/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Encoders

use derivative::Derivative;
use educe::Educe;
use log::Record;
use std::{fmt, io};

Expand Down Expand Up @@ -94,8 +94,8 @@ pub enum Color {
///
/// Any fields set to `None` will be set to their default format, as defined
/// by the `Write`r.
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Educe)]
#[educe(Debug)]
#[derive(Clone, Eq, PartialEq, Hash, Default)]
pub struct Style {
/// The text (or foreground) color.
Expand All @@ -104,7 +104,7 @@ pub struct Style {
pub background: Option<Color>,
/// True if the text should have increased intensity.
pub intense: Option<bool>,
#[derivative(Debug = "ignore")]
#[educe(Debug = "ignore")]
_p: (),
}

Expand Down
8 changes: 4 additions & 4 deletions src/encode/pattern/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
//! [MDC]: https://crates.io/crates/log-mdc

use chrono::{Local, Utc};
use derivative::Derivative;
use educe::Educe;
use log::{Level, Record};
use std::{default::Default, io, process, thread};

Expand Down Expand Up @@ -671,11 +671,11 @@ impl FormattedChunk {
}

/// An `Encode`r configured via a format string.
#[derive(Derivative)]
#[derivative(Debug)]
#[derive(Educe)]
#[educe(Debug)]
#[derive(Clone, Eq, PartialEq, Hash)]
pub struct PatternEncoder {
#[derivative(Debug = "ignore")]
#[educe(Debug = "ignore")]
chunks: Vec<Chunk>,
pattern: String,
}
Expand Down