Skip to content

Commit

Permalink
352 readme cleanup (#361)
Browse files Browse the repository at this point in the history
* chore: clippy fixes + set a max toml version to control MSRV bumps

* chore: cleanup readme gzip note
  • Loading branch information
bconn98 authored Mar 3, 2024
1 parent c981ca4 commit bcd7fb0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ fnv = "1.0"
humantime = { version = "2.1", optional = true }
log = { version = "0.4.20", features = ["std"] }
log-mdc = { version = "0.1", optional = true }
serde = { version = "1.0", optional = true, features = ["derive"] }
serde = { version = "1.0.196", optional = true, features = ["derive"] }
serde-value = { version = "0.7", optional = true }
thread-id = { version = "4", optional = true }
typemap-ors = { version = "1.0.0", optional = true }
serde_json = { version = "1.0", optional = true }
serde_yaml = { version = "0.9", optional = true }
toml = { version = "0.8", optional = true }
toml = { version = "<0.8.10", optional = true }
parking_lot = { version = "0.12.0", optional = true }
rand = { version = "0.8", optional = true}
thiserror = "1.0.15"
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,6 @@
log4rs is a highly configurable logging framework modeled after Java's Logback
and log4j libraries.

## Warning

If you are using the file rotation in your configuration there is a known
substantial performance issue so listen up! By default the `gzip` feature
is enabled and when rolling files it will zip log archives automatically.
This is a problem when the log archives are large as the zip happens in the
main thread and will halt the process while the zip is completed. Be advised
that the `gzip` feature will be removed from default features as of `1.0`.

The methods to mitigate this are as follows.

1. Use the `background_rotation` feature which spawns an os thread to do the compression.
1. Disable the `gzip` feature with `--no-default-features`.
1. Ensure the archives are small enough that the compression time is acceptable.

For more information see the PR that added [`background_rotation`](https://github.com/estk/log4rs/pull/117).

## Quick Start

log4rs.yaml:
Expand Down Expand Up @@ -82,6 +65,23 @@ fn main() {
* Run the tests for all individual features for windows with
[cross](https://github.com/rust-embedded/cross): `./test.sh win`


## Compression

If you are using the file rotation in your configuration there is a known
substantial performance issue with the `gzip` feature. When rolling files
it will zip log archives automatically. This is a problem when the log archives
are large as the zip happens in the main thread and will halt the process while
the zip is completed.

The methods to mitigate this are as follows.

1. Use the `background_rotation` feature which spawns an os thread to do the compression.
2. Do not enable the `gzip` feature.
3. Ensure the archives are small enough that the compression time is acceptable.

For more information see the PR that added [`background_rotation`](https://github.com/estk/log4rs/pull/117).

## License

Licensed under either of
Expand Down
2 changes: 1 addition & 1 deletion src/append/rolling_file/policy/compound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
//! Requires the `compound_policy` feature.
#[cfg(feature = "config_parsing")]
use serde::{self, de};
use serde::de;
#[cfg(feature = "config_parsing")]
use serde_value::Value;
#[cfg(feature = "config_parsing")]
Expand Down
8 changes: 3 additions & 5 deletions src/config/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@
//! ```
#![allow(deprecated)]

use std::{
borrow::ToOwned, collections::HashMap, fmt, marker::PhantomData, sync::Arc, time::Duration,
};
use std::{collections::HashMap, fmt, marker::PhantomData, sync::Arc, time::Duration};

use anyhow::anyhow;
use derivative::Derivative;
Expand Down Expand Up @@ -288,9 +286,9 @@ impl Deserializers {
}

/// Deserializes a value of a specific type and kind.
pub fn deserialize<T: ?Sized>(&self, kind: &str, config: Value) -> anyhow::Result<Box<T>>
pub fn deserialize<T>(&self, kind: &str, config: Value) -> anyhow::Result<Box<T>>
where
T: Deserializable,
T: Deserializable + ?Sized,
{
match self.0.get::<KeyAdaptor<T>>().and_then(|m| m.get(kind)) {
Some(b) => b.deserialize(config, self),
Expand Down
2 changes: 1 addition & 1 deletion src/config/runtime.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! log4rs configuration
use log::LevelFilter;
use std::{collections::HashSet, iter::IntoIterator};
use std::collections::HashSet;
use thiserror::Error;

use crate::{append::Append, filter::Filter};
Expand Down

0 comments on commit bcd7fb0

Please sign in to comment.