Skip to content

Commit

Permalink
Fix #152
Browse files Browse the repository at this point in the history
- udpate dependencies
- raise MSRV to 1.67.1
  • Loading branch information
emabee committed Nov 10, 2023
1 parent 2f1ab2d commit 9f7699e
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
rust: [ stable, 1.66.1 ]
rust: [ stable, 1.67.1 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.27.3] - 2023-11-10

Fix [issue #152](https://github.com/emabee/flexi_logger/issues/152).

## [0.27.2] - 2023-09-27

Fix wrong timestamp handling for the second rotation (second part of issue #150).
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flexi_logger"
version = "0.27.2"
version = "0.27.3"
authors = ["emabee <meinolf.block@sap.com>"]
categories = ["development-tools::debugging"]
description = """
Expand All @@ -15,7 +15,7 @@ keywords = ["file", "logger"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/emabee/flexi_logger"
rust-version = "1.66.0"
rust-version = "1.67.1"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ See

## Minimal rust version

The minimal supported rust version is currently "1.66.0",
The minimal supported rust version is currently "1.67.1",
due to a change in a patch version of a dependency.

## Crate Features
Expand Down
76 changes: 38 additions & 38 deletions scripts/qualify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,83 @@ extern crate yansi;
use std::process::Command;

macro_rules! run_command {
($cmd:expr , $($arg:expr),*) => (
let mut command = command!($cmd, $($arg),*);
($cmd:expr) => {
let mut command = command!($cmd);
let mut child = command.spawn().unwrap();
let status = child.wait().unwrap();
if !status.success() {
print!("> {}",yansi::Paint::red("qualify terminates due to error"));
print!("> {}", yansi::Paint::red("qualify terminates due to error"));
std::process::exit(-1);
}
)
};
}

macro_rules! command {
($cmd:expr , $($arg:expr),*) => (
{
print!("\n> {}",yansi::Paint::yellow($cmd));
let mut command = Command::new($cmd);
$(
print!(" {}",yansi::Paint::yellow(&$arg));
command.arg($arg);
)*
print!("\n");
command
($cmd:expr) => {{
print!("\n> {}\n", yansi::Paint::yellow($cmd));
let mut chips = $cmd.split(' ');
let mut command = Command::new(chips.next().unwrap());
for chip in chips {
command.arg(chip);
}
)
command
}};
}

fn run_script(s: &str) {
let mut path = std::path::PathBuf::from(std::env::var("CARGO_SCRIPT_BASE_PATH").unwrap());
path.push(s);
let script = path.to_string_lossy().to_owned().to_string();
run_command!("cargo", "script", script);
let command = format!(
"cargo script {}",
path.to_string_lossy().to_owned().to_string()
);
run_command!(&command);
}

fn main() {
println!("Qualify flexi_logger");

// format
run_command!("cargo", "fmt");
run_command!("cargo fmt");

// Build in important variants
std::fs::remove_file("Cargo.lock").ok();
run_command!("cargo", "+1.66.1", "build", "--no-default-features");
run_command!("cargo", "+1.66.1", "build", "--all-features");
run_command!("cargo +1.67.1 build --no-default-features");
run_command!("cargo +1.67.1 build --all-features");

std::fs::remove_file("Cargo.lock").ok();
run_command!("cargo", "build");
run_command!("cargo", "build", "--no-default-features");
run_command!("cargo build");
run_command!("cargo build --no-default-features");
#[rustfmt::skip]
run_command!("cargo", "build", "--no-default-features", "--features=is-terminal");
run_command!("cargo", "build", "--all-features");
run_command!("cargo", "build", "--release");
run_command!("cargo", "build", "--release", "--all-features");
run_command!("cargo build --no-default-features --features=is-terminal");
run_command!("cargo build --all-features");
run_command!("cargo build --release");
run_command!("cargo build --release --all-features");

// Clippy in important variants
run_command!("cargo", "clippy", "--", "-D", "warnings");
run_command!("cargo", "clippy", "--all-features", "--", "-D", "warnings");
run_command!("cargo clippy -- -D warnings");
run_command!("cargo clippy --all-features -- -D warnings");
#[rustfmt::skip]
run_command!("cargo", "+nightly", "clippy", "--all-targets", "--all-features", "--", "-D", "warnings");
run_command!("cargo +nightly clippy --all-targets --all-features -- -D warnings");

// Run tests in important variants
run_command!("cargo", "+1.66.1", "test", "--all-features");
run_command!("cargo", "test", "--release", "--all-features");
run_command!("cargo", "test", "--no-default-features");
run_command!("cargo", "test", "--release");
run_command!("cargo +1.67.1 test --all-features");
run_command!("cargo test --release --all-features");
run_command!("cargo test --no-default-features");
run_command!("cargo test --release");
#[rustfmt::skip]
run_command!("cargo", "test", "--release", "--features", "specfile_without_notification");
run_command!("cargo test --release --features specfile_without_notification");

// doc
run_command!("cargo", "+nightly", "test", "--all-features", "--doc");
run_command!("cargo +nightly test --all-features --doc");
#[rustfmt::skip]
run_command!("cargo", "+nightly", "doc", "--all-features", "--no-deps", "--open");
run_command!("cargo +nightly doc --all-features --no-deps --open");

// check version consistency
run_command!("cargo", "run", "--example", "version_numbers");
run_command!("cargo run --example version_numbers");

// check git status
let mut cmd = command!("git", "status", "-s");
let mut cmd = command!("git status -s");
let child = cmd.stdout(std::process::Stdio::piped()).spawn().unwrap();
let output = child.wait_with_output().unwrap();
if output.stdout.len() > 0 {
Expand Down
42 changes: 21 additions & 21 deletions scripts/qualify_fast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,52 @@ extern crate yansi;
use std::process::Command;

macro_rules! run_command {
($cmd:expr , $($arg:expr),*) => (
let mut command = command!($cmd, $($arg),*);
($cmd:expr) => {
let mut command = command!($cmd);
let mut child = command.spawn().unwrap();
let status = child.wait().unwrap();
if !status.success() {
print!("> {}",yansi::Paint::red("qualify terminates due to error"));
print!("> {}", yansi::Paint::red("qualify terminates due to error"));
std::process::exit(-1);
}
)
};
}

macro_rules! command {
($cmd:expr , $($arg:expr),*) => (
{
print!("\n> {}",yansi::Paint::yellow($cmd));
let mut command = Command::new($cmd);
$(
print!(" {}",yansi::Paint::yellow(&$arg));
command.arg($arg);
)*
print!("\n");
command
($cmd:expr) => {{
print!("\n> {}\n", yansi::Paint::yellow($cmd));
let mut chips = $cmd.split(' ');
let mut command = Command::new(chips.next().unwrap());
for chip in chips {
command.arg(chip);
}
)
command
}};
}

fn run_script(s: &str) {
let mut path = std::path::PathBuf::from(std::env::var("CARGO_SCRIPT_BASE_PATH").unwrap());
path.push(s);
let script = path.to_string_lossy().to_owned().to_string();
run_command!("cargo", "script", script);
let command = format!(
"cargo script {}",
path.to_string_lossy().to_owned().to_string()
);
run_command!(&command);
}

fn main() {
// Build in important variants
run_command!("cargo", "build", "--release", "--all-features");
run_command!("cargo build --release --all-features");

// Clippy in important variants
run_command!("cargo", "clippy", "--all-features", "--", "-D", "warnings");
run_command!("cargo clippy --all-features -- -D warnings");

// Run tests in important variants
run_command!("cargo", "test", "--release", "--all-features");
run_command!("cargo test --release --all-features");
run_script("cleanup");

// doc
run_command!("cargo", "doc", "--all-features", "--no-deps", "--open");
run_command!("cargo doc --all-features --no-deps --open");

// say goodbye
println!(
Expand Down
3 changes: 2 additions & 1 deletion src/writers/file_log_writer/state/list_and_cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub(super) fn list_of_infix_files() -> Vec<PathBuf> {
}
fn list_of_files(pattern: &str) -> Vec<PathBuf> {
let mut log_files: Vec<PathBuf> = glob::glob(pattern)
.unwrap(/* failure should be impossible */)
.unwrap(/* PatternError should be impossible */)
// ignore all files with GlobError
.filter_map(Result::ok)
.collect();
log_files.sort_unstable(); // should be no-op, but we don't want to rely on glob doing it
Expand Down
7 changes: 5 additions & 2 deletions src/writers/file_log_writer/state/timestamps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ pub(super) fn collision_free_infix_for_rotated_file(
}
let mut pattern = pattern.to_string_lossy().to_string();
pattern.push_str(".restart-*");
let mut restart_siblings =
glob::glob(&pattern).unwrap(/*ok*/).map(Result::unwrap).collect::<Vec<PathBuf>>();
let mut restart_siblings = glob::glob(&pattern)
.unwrap(/* PatternError should be impossible */)
// ignore all files with GlobError
.filter_map(Result::ok)
.collect::<Vec<PathBuf>>();

// if collision would occur (new_path or compressed new_path exists already),
// find highest restart and add 1, else continue without restart
Expand Down

0 comments on commit 9f7699e

Please sign in to comment.