Skip to content

Latest commit

 

History

History
176 lines (126 loc) · 5.33 KB

CHANGELOG.md

File metadata and controls

176 lines (126 loc) · 5.33 KB

CHANGELOG

All notable changes to this project will be documented in this file.

[0.18.1] 2024-11-17

New features

  • Re-export broadcast and native_tls constructors from fasyslog (#81).

[0.18.0] 2024-11-14

Breaking changes

  • The mapping between syslog severity and log's level is changed.
    • log::Level::Error is mapped to syslog::Severity::Error (unchanged).
    • log::Level::Warn is mapped to syslog::Severity::Warning (unchanged).
    • log::Level::Info is mapped to syslog::Severity::Notice (changed).
    • log::Level::Debug is mapped to syslog::Severity::Info (changed).
    • log::Level::Trace is mapped to syslog::Severity::Debug (unchanged).

New features

  • Add journald feature to support journald appenders (#80).

[0.17.1] 2024-11-12

Refactors

  • Change the re-export of syslog to logforth::syslog::fasyslog (#74)

[0.17.0] 2024-11-12

New features

  • Add syslog feature to support syslog appenders (#72)

Breaking changes

Two breaking changes in #72:

  1. rolling_file feature flag is renamed to rolling-file.
  2. NonBlocking related structures and methods are relocated, now you'd construct a non-blocking like:
fn main() {
    let rolling_writer = RollingFileWriter::builder()
        .rotation(Rotation::Daily)
        .filename_prefix("app_log")
        .build("logs")
        .unwrap();

    let (non_blocking, _guard) = rolling_file::non_blocking(rolling_writer).finish();

    logforth::builder()
        .dispatch(|d| {
            d.filter(log::LevelFilter::Trace)
                .append(RollingFile::new(non_blocking).with_layout(JsonLayout::default()))
        })
        .apply();
}

or:

fn main() {
    let syslog_writer = SyslogWriter::tcp_well_known().unwrap();
    let (non_blocking, _guard) = syslog::non_blocking(syslog_writer).finish();

    logforth::builder()
        .dispatch(|d| {
            d.filter(log::LevelFilter::Trace)
                .append(Syslog::new(non_blocking))
        })
        .apply();
}

Note that each NonBlocking now has a type parameter to ensure that they match the corresponding appenders.

[0.16.0] 2024-10-30

Breaking changes

Two minor breaking changes in #71:

  1. JsonLayout's field tz is now private. You can change it with the new timezone method, like JsonLayout::default().timezone(TimeZone::UTC).
  2. DispatchBuilder now always accepts filter first, and then append. Once an append is configured, no more filter can be added. This is for a strict order on config so that the code is more consistent.

[0.15.0] 2024-10-30

Breaking changes

API is further improve in both #69 and #70.

Now the logger build logic is like:

use log::LevelFilter;
use logforth::append;
use logforth::layout::JsonLayout;

fn main() {
    logforth::builder()
        .dispatch(|b| b.filter(LevelFilter::Debug).append(append::Stderr::default().with_layout(JsonLayout::default())))
        .dispatch(|b| b.filter(LevelFilter::Info).append(append::Stdout::default().with_layout(JsonLayout::default())))
        .apply();
}

And we provide a convenient way to build the logger with default setup (stderr or stdout, with RUST_LOG envvar respected):

fn main() {
    logforth::stderr().apply();
    // or logforth::stdout().apply(); // for logging to stdout
}

[0.14.0] 2024-10-28

Breaking changes

  1. refactor: layouts and encoders should be nested to appenders (#64)

    Previous code:

    fn main() {
        Logger::new()
            .dispatch(
                Dispatch::new()
                    .filter(LevelFilter::Trace)
                    .layout(JsonLayout::default())
                    .append(append::Stdout),
            )
            .apply()
            .unwrap();
    
        log::error!("Hello error!");
        log::warn!("Hello warn!");
        log::info!("Hello info!");
        log::debug!("Hello debug!");
        log::trace!("Hello trace!");
    }

    New code:

    fn main() {
        Logger::new()
            .dispatch(
                Dispatch::new()
                    .filter(LevelFilter::Trace)
                    .append(append::Stdout::default().with_layout(JsonLayout::default())),
            )
            .apply()
            .unwrap();
    
        log::error!("Hello error!");
        log::warn!("Hello warn!");
        log::info!("Hello info!");
        log::debug!("Hello debug!");
        log::trace!("Hello trace!");
    }

    Besides, the default layout of Stdout, Stderr, and RollingFile is changed from IdenticalLayout to TextLayout.

  2. refactor: unify level/target filter to directive filter (#65)

    Most From conversions are kept so that typically you won't notice the change. But if you directly use LevelFilter and TargetFilter, they are now removed. The functionalities can be covered by EnvFilter.

    Also, the feature flag env-filter is removed. The EnvFilter is always available now.