All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Fix issue #184.
Update dependencies.
Bump minimal supported rust version to 1.72.0.
Allow for custom process names when using the syslog writer (PR #182, kudos to Julien JPK).
Fix issue #181.
Increase stack sizes for flusher threads from very minimal 128 to 1024 bytes.
Add badge for OpenSSF Best Practices.
Fix issue #179 that in rotation with custom time format the custom time format was not applied properly (kudos to alboyer).
Remove the RwLock around the color palette.
Removed dependency to glob
by implementing the necessary file searches explicitly,
to fix issue-173.
Fix a regression (issue #178) introduced with [0.29.1].
Fix error with rotation & append & explicit directory & Naming::Timestamps.
Fix issue #176: leading underscore in log file name if only the infix is used (no basename, no start time, no discriminant).
Revised SyslogWriter
(-> version bump): introduced builder pattern,
added a configuration option for the message format
(resolves issue #168, kudos to krims0n32).
LoggerHandle::existing_log_files
now also returns a meaningful result if file rotation is not
used. Kudos to drdo for
discussion 170.
Remove unnecessary dependency to is-terminal
.
Add impl From<LevelFilter>
for LogSpecification
.
Kudos to Oakchris1955.
Fix issue #162 (FileLogWriter does not follow its max_level), kudos to JoeWildfong.
Add special handling for empty current infix to Naming::TimestampsCustomFormat
(issue #161).
Add variant Naming::TimestampsCustomFormat
(issue #158),
kudos to jb-alvarado.
Introduce flexi_logger::init()
as super-minimal entry usage.
Update dependencies.
Detach from lazy_static
, use std::sync::OnceLock
instead.
Bump minimal supported rust version to 1.70.
If flexi_logger
runs into issues itself, it will try to write error messages into the configured
error output channel. By default, flexi_logger
panics if writing to the error output channel fails.
It is now possible to gracefully "swallow" the error messages and continue
(see panic_if_error_channel_is_broken).
The new feature kv
allows making use of the kv
feature of log
together with flexi_logger
s
format functions, and adds a dependency to log/kv_serde
.
The new feature json
adds a format function json_format
and dependencies to serde_json
,
serde
and serde_derive
.
Add ability to omit the basename cleanly, without leading underscore (issue #153, kudos to krystejj.
Fix issue #152.
Fix wrong timestamp handling for the second rotation (second part of issue #150).
Fix issues with sub-second rotations and with cleanup when all logfiles should be compressed (issue #150).
Revise, and modify the signature of, LoggerHande::existing_log_files()
(version bump).
Extend the trait LogWriter
with an optional method rotate
.
Extend impact of LoggerHande::trigger_rotation()
to all configured writers.
Introduce new naming variants that work without _rCURRENT
files: Naming::TimestampsDirect
and Naming::NumbersDirect
(delivers #127).
Improve documentation of filename handling.
Introduce LoggerHandle.trigger_rotation()
(delivers #147).
Re-open output also for other writers (delivers #143).
Rename method to re-open output from LoggerHandle (leads to version bump).
Use dep:
in Cargo.toml for references to most dependencies, in order to avoid implicit "features".
Fix #145 (minor internal optimization).
Add methods
LoggerHandle::adapt_duplication_to_stderr
and LoggerHandle::adapt_duplication_to_stdout
(realizes issue #142).
Extend docu on providing custom format.
Use rust-script instead of cargo-script for qualification scripts.
Update dependencies.
Use display (rather than debug) formatting for thread names (kudos to mpalmer).
Add LoggerHandle::existing_log_files()
.
Introduce additional WriteMode
variant SupportCapture
.
Replace dependency atty
with is-terminal
, due to
RUSTSEC-2021-0145.
Use chrono's support for rfc3339. Improve tests for DeferredNow
.
Fix issues #132 and #133.
Update dependencies.
Bump MSRV to 1.60, because toml needs it now.
Improve documentation of feature dependencies.
Minor stuff.
Move from unmaintained ansi_term
to nu-ansi-term
.
Fix new clippies.
Some improvements in respect to use_utc
:
- add method DeferredNow::now_utc_owned()
- documentation
- test improvement
Revert back to using chrono
, since chrono
is now fortunately maintained again and its timezone
handling is fixed meanwhile
- this change largely reverts the changes done for [0.19.6]
- a version bump is necessary since this affects the API, e.g. in
DeferredNow
- the feature
use_chrono_for_offset
became obsolete and is removed
On linux and Mac, improve the logic that handles the issue described again in issue-122.
Re-introduce LoggerHandle::clone()
.
Fix security advisory (see #117) by replacing the dependency from notify 4.0
with
notify-debouncer-mini 0.2
(which depends on notify 5.0
). As a side-effect,
the thread flexi_logger-specfile-watcher
is replaced with notify-rs debouncer loop
.
Adapt and simplify the submodule trc
a bit.
Fix a panic that can happen if Naming::Timestamps
and FileSpec::o_suffix(None)
are used and
rotation happens within a second (issue-116).
Bump MSRV to 1.59 (because the time
crate did this).
Switch to edition 2021, use latest patch of time
version "0.3",
bump minimal supported rust version to "1.57.0".
Add interconversions between log::LevelFilter and flexi_logger::Duplicate (kudos to rlee287).
Only depend on the parts of crossbeam that are used (kudos to bsilver8192).
Add support for Rfc3164 to SyslogWriter
(kudos to mbodmer).
Add Clone
and Copy
implementations to enum Duplicate (kudos to
ComplexSpaces).
Code maintenance: remove the feature "external_rotation".
Bump minimal version of time
crate to "0.3.7".
Add LoggerHandle::reopen_outputfile
and deprecate feature external_rotation
.
Enable symlink on all unix platforms, not just linux.
Rework the optional syslog writer (kudos to ObsceneGiraffe):
- bugfix: write only full lines
- use owned buffer to avoid allocations
- encapsulate implementation details
- remove additional buffer from
SyslogConnector::Tcp
Add method LoggerHandle::flw_config
(kudos to Ivan Azoyan).
Reduce the used feature-list of the optional dependency chrono (to get rid of an indirect dependency to an old time version).
Add feature external_rotation
.
Improve the option to use UTC for all timestamps (in filenames and log lines) (https://docs.rs/flexi_logger/latest/flexi_logger/struct.Logger.html#method.use_utc) such that the error message regarding a failed offset detection is not provoked if UTC is enforced.
The API modification done in 0.21.0 to DeferredNow
is reverted.
Add option to use UTC for all timestamps (in filenames and log lines).
Add the optional feature use_chrono_for_offset
as a workaround for the current behavior
of time
on unix.
Add an option to configure the error output channel.
Switch to time 0.3.5
, and retrieve the UTC offset while flexi_logger
is initialized.
See also time
's CHANGELOG.
Reason for the version bump:
The inner representation of DeferredNow
has changed from chrono::DateTime<Local>
to time::OffsetDateTime
, and this is visible e.g. to implementors of format functions.
Use time
directly, instead of chrono
,
due to RUSTSEC-2020-0159.
Bumps the minimal supported rust version to 1.51.0. Improves performance a bit.
Unfortunately, this version suffers on linux from time
's somewhat radical behavior
to not support UTC offsets on linux.
Remove time 0.1 from dependency tree (see PR 96) - kudos to complexspaces!
Add feature dont_minimize_extra_stacks
(fixes issue-95) -
kudos to leishiao!
Fix issue-94 - kudos to leishiao!
Platform-specific fixes, and introduction of github-actions-based CI. Kudos to dallenng and HEnquist!
FileLogWriter
has been functionally extended to make it usable "stand-alone".
As part of that, the FlWriteMode
is gone, and the normal WriteMode
is used.
WriteMode::BufferDontFlushWith
was added.
A new experimental feature (and module) "trc" allows using flexi_logger
functionality
with tracing
.
Error handling is improved, error codes are documented comprehensively, errors now also print a link to the error documentation.
Default color for DEBUG lines was changed (fixes issue-88, kudos goes to HEnquist!).
Test coverage is improved.
Implement async mode also for log_to_stdout()
and log_to_stderr()
.
Significant API revision, to better cope with new features and for better readability/applicability.
Most important changes:
- Better error handling in factory methods:
Logger::with_env()
is replaced withLogger::try_with_env()
, which returns aResult
Logger::with_str()
is replaced withLogger::try_with_str()
, which returns aResult
Logger::with_env_or_str()
is replaced withLogger::try_with_env_or_str()
, which returns aResult
- consequently, the method
Logger::check_parser_error
is gone
- Bundling file-related aspects
- introduction of
FileSpec
- move of filename-related methods from
Logger
toFileSpec
(and similarly on theFileLogWriter
)
- introduction of
Logger::log_target(LogTarget)
is replaced with a set of methodsLogger::log_to_file(FileSpec)
Logger::log_to_stdout()
Logger::log_to_stderr()
Logger::log_to_writer(Box<dyn LogWriter>)
Logger::log_to_file_and_writer(FileSpec,Box<dyn LogWriter>)
Logger::do_not_log()
- The new method
Logger::write_mode(WriteMode)
- replaces several methods to control buffer handling etc
- offers additionally asynchronous file I/O (if the crate feature
async
is used)
- Keeping the
LoggerHandle
alive has become crucial (except for trivial cases)! - Several methods are now more generic with their input parameters
- A new method
LoggerHandle::reset_flw
allows reconfiguring a usedFileLogWriter
at runtime
Added an option to apply a stateful filter before log lines are really written (kudos to jesdazrez (Jesús Trinidad Díaz Ramírez)!).
Fixed error handling in logspec parsing (wrong error was thrown).
Several docu improvements.
Add options Logger::buffer_and_flush()
and buffer_and_flush_with()
as means to avoid long output delays.
Introduce optional buffering of log output. This increases performance (which can be relevant for programs with really high log production), but delays log line appearance in the output, which can be confusing, and requires to flush or shutdown the logger at the end of the program to ensure that all logs are written to the output before the program terminates.
Reduce the size of LogConfiguration
considerably by moving the optional and rarely used textfilter
into the heap. This unfortunately leads to an incompatible change in a rarely used public method
(LogConfiguration::text_filter()
was returning a &Option<Regex>
,
and is now returning Option<&Regex>
), which enforces a version bump.
Rename ReconfigurationHandle to LoggerHandle (and add an type alias with the old name).
Add the public method LoggerHandle::flush()
.
Expose DeferredNow::new()
.
Add some must_use
annotations where appropriate.
Add module code-examples with additional usage documentation. This is a follow-up of a PR, kudos goes to devzbysiu!
Support empty toml spec files (kudos to ijackson for pull request 66!) (was supposed to be part of 0.16.0, but I had forgotten to merge it).
If file logging is used, do not create the output file if no log is written. Solves issue-62.
Improve color handling
- introduce AdaptiveFormat for a clearer API
- Support using feature
atty
without provided coloring - Extend example
colors
to provide insight in how AdaptiveFormat works - Remove the deprecated method
Logger::do_not_log()
; uselog_target()
withLogTarget::DevNull
instead. - Remove deprecated method
Logger::o_log_to_file()
; uselog_target()
instead. The clearer convenience methodLogger::log_to_file()
is still available.
Improve the compression feature. Solves issue-65.
- breaking change: change the file suffix for the compressed log files from
.zip
to.gz
- Fix wrong wording in code and documentation
- deprecate the feature name
ziplog
and call the feature nowcompress
- rename
Cleanup::KeepZipFiles
intoCleanup::KeepCompressedFiles
andCleanup::KeepLogAndZipFiles
intoCleanup::KeepLogAndCompressedFiles
- the old names still work but are deprecated
If file logging is used, do not create the output file if no log is written Solves issue issue-62.
Make 1.37.0
the minimal rust version for flexi_logger
.
Introduce feature specfile_without_notification
to allow coping with OS issues
(solves issue-59).
Minor code maintenance.
Allow using the log target with fantasy names, like with env_logger
.
Solves issue-56.
Allow modifying the coloring palette through the environment variable FLEXI_LOGGER_PALETTE
.
See function style for details.
Solves issue-55.
By default, don't use colors if stdout or stderr are not a terminal Solves issue-57.
Add variant Criterion::AgeOrSize (kudos to pscott!, PR-54).
Add some Debug derives (kudos to pscott!, PR-52).
Introduce separate formatting for stdout (kudos to pscott!, PR-51).
Deprecate Logger::do_not_log()
.
Add Logger::duplicate_to_stdout()
to fix
issue-47.
Fix issue-45, which was a panic in the specfile watcher when some log files were deleted manually while the program was running (kudos to avl!, PR-46).
Add compatibility with multi_log by adding methods
Logger::build
and Logger::build_with_specfile
(fixes issue-44).
Add LogSpecBuilder::insert_modules_from()
(fixes issue-43).
Improve handling of parse-errors.
Fix default format for files (was and is documented to be uncolored, but was colored).
Make the textfilter functionality an optional default feature;
deselecting it removes the regex crate as a required dependency,
which reduces the size overhead for any binary using flexi_logger
(kudos to Petre Eftime!).
Refine and rename error variants to allow e.g. differentiating between errors related to the output (files) and errors related to the specfile.
Make cleanup more robust, and allow controlling the cleanup-thread also with
Logger::start_with_specfile()
.
If rotation is used with cleanup, do the cleanup by default in a background thread (solves issue 39).
For the ziplog feature, switch from zip
crate to flate2
.
Fix issue 38 (Old log files are not removed if rCURRENT doesn't overflow).
Pass format option into custom loggers (pull request 37).
Fix bug in specfile handling (issue 36).
Improve docu and implementation of create_symlink.
Minor other stuff.
Allow defining custom handlers for the default log target (solves issue 32).
Use implicit locking of stderr in StdErrWriter.
Allow failures in travis' windows build.
Add license files.
Support recursive logging also with FileLogWriter, sharing the buffer with the PrimaryWriter.
Fix multi-threading issue (incorrect line-break handling with stderr).
Further stabilize the specfile feature.
Remove LogSpecification::ensure_specfile_exists()
and LogSpecification::from_file()
from public API, where they should not be (-> version bump).
Harmonize all eprintln! calls to
prefix the output with "[flexi_logger]
".
Only relevant for the specfile
feature:
initialize the logger before dealing in any way with the specfile,
and do the initial read of the specfile in the main thread,
i.e. synchronously, to ensure a deterministic behavior during startup
(fixes issue 31).
Improve the file watch for the specfile to make the specfile
feature more robust.
E.g. allow editing the specfile on linux
with editors that move the original file to a backup name.
Add an option to write the log to stdout, as recommended for twelve-factor apps.
Make get_creation_date() more robust on all platforms.
Fix fatal issue with get_creation_date() on linux (see #30).
Improve performance for plain stderr logging.
Improve robustnesss for recursive log calls.
Revise handling of record.metadata().target() versus record.module_path().
Incompatible API modification: Logger.rotate() takes now three parameters.
Suppport different formatting for stderr and files.
Add feature colors
(see README.md
for details).
Remove the deprecated Logger::start_reconfigurable()
and Logger::rotate_over_size()
.
Fix issue 26 (logging off for specific modules).
Fix issue 27 (log files blank after restart).
Fix issue 28 (add a corresponding set of unit tests to FileLogWriter).
Version updates of dependencies.
Add SyslogWriter.
Change API to more idiomatic parameter types, in a compatible way.
Add first implementation of a SyslogWriter.
Add option to write windows line endings, rather than a plain \n
.
Add options to cleanup rotated log files, by deleting and/or zipping older files.
Remove some deprecated methods.
Let the BlackHoleLogger, although it doesn't write a log, still duplicate to stderr.
Deprecate Logger::start_reconfigurable()
, let Logger::start()
return a reconfiguration handle.
Add an option to write all logs to nowhere (i.e., do not write any logs).
Eliminate performance penalty for using reconfigurability.
Add methods to modify the log spec temporarily.
Advance to edition 2018.
Log-spec parsing is improved, more whitespace is tolerated.
When file rotation is used, the name of the file to which the logs are written is now stable.
Details:
- the logs are always written to a file with infix _rCURRENT
- if this file exceeds the specified rotate-over-size, it is closed and renamed to a file with a sequential number infix, and then the logging continues again to the (fresh) file with infix _rCURRENT
Example:
After some logging with your program my_prog, you will find files like
my_prog_r00000.log
my_prog_r00001.log
my_prog_r00002.log
my_prog_rCURRENT.log
LogSpecification::parse()
now returns a Result<LogSpecification, FlexiLoggerError>
, rather than
a log spec directly (-> version bump).
This enables a more reliable usage of FlexiLogger in non-trivial cases.
For the sake of compatibility for the normal usecases, the Logger methods with_str()
etc.
remain unchanged. An extra method is added to retrieve parser errors, if desired.
Docu improvement.
Fix incorrect filename generation with rotation, i.e., switch off timestamp usage when rotation is used.
Introduce Logger::duplicate_to_stderr()
, as a more flexible replacement for duplicate_error()
and duplicate_info()
.
Get rid of the unneccessary String allocation we've been carrying with us since ages. This implies changing the signature of the format functions.
In case you provide your own format function, you'll need to adapt it to the new signature. Luckily, the effort is low.
As an example, here is how the definition of the opt_format
function changed:
- pub fn opt_format(record: &Record) -> String {
- format!(
---
+ pub fn opt_format(w: &mut io::Write, record: &Record) -> Result<(), io::Error> {
+ write!(
+ w,
Similarly, if you're using the advanced feature of providing your own implementation of LogWriter, you need to adapt it. The change again is trivial, and should even slightly simplify your code (you can return io errors and don't have to catch them yourself).
The docu generation on docs.rs is now configured to considers all features, we thus
expose Logger.start_with_specfile()
only if the specfile feature is used. So we can revert the
change done with 0.8.1.
Add flexi_logger to category development-tools::debugging
Make append() also work for rotating log files
Add option to append to existing log files, rather than always truncating them
Expose Logger.start_with_specfile()
always
...and not only if the feature "specfile" is used - otherwise it does not appear
in the auto-generated docu (because it does not use --allfeatures)
Add specfile feature
- Add a feature that allows to specify the LogSpecification via a file that can be edited while the program is running _ Remove/hide deprecated APIs
- As a consequence, cleanup code, get rid of duplicate stuff.
Bugfix: do not create empty files when used in env_logger style. Update docu and the description in cargo.toml
Add support for multiple log output streams
- replace FlexiWriter with DefaultLogWriter, which wraps a FileLogWriter
- add test where a SecurityWriter and an AlertWriter are added
- add docu
- move deprecated structs to separate package
- move benches to folder benches
Add Logger::try_with_env_or_str()
Add ReconfigurationHandle::parse_new_spec()
Fix README.md
Publish version based on log 0.4
Use builder pattern for LogSpecification and Logger
- deprecate outdated API
- "objectify" LogSpecification
- improve documentation, e.g. document the dash/underscore issue