trussed-dev / delog Goto Github PK
View Code? Open in Web Editor NEWDeferred logging, an implementation and extension of Rust's standard logging facade.
Home Page: https://docs.rs/delog
License: Apache License 2.0
Deferred logging, an implementation and extension of Rust's standard logging facade.
Home Page: https://docs.rs/delog
License: Apache License 2.0
The *_now!
macros set the log target to !
, making it harder to interpret and filter log messages if std-log
is enabled.
The macros generated with generate_macros
are only intended to be used in their own crate so we don’t need #[macro_export]
.
Hello,
having multiple references with at least one of them being &mut
to the same memory is considered undefined behavior in Rust.
Code like this:
fn main() {
let r1 = delog::logger();
let r2 = delog::logger();
core::hint::black_box((r1, r2));
}
Is absolutely safe and using public interface, yet triggering UB.
Miri output:
Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
Compiling delog v0.1.7
Compiling log v0.4.20
Compiling delog_ub v0.1.0 (/home/ddystopia/code/delog_ub)
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
Running `/home/ddystopia/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner /home/ddystopia/code/delog_ub/target/miri/x86_64-unknown-linux-gnu/debug/delog_ub`
error: Undefined Behavior: trying to retag from <1689> for Unique permission at alloc824[0x0], but that tag does not exist in the borrow stack for this location
--> src/main.rs:5:28
|
5 | core::hint::black_box((r1, r2));
| ^^
| |
| trying to retag from <1689> for Unique permission at alloc824[0x0], but that tag does not exist in the borrow stack for this location
| this error occurs as part of retag at alloc824[0x0..0x10]
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <1689> was created by a Unique retag at offsets [0x0..0x10]
--> src/main.rs:2:14
|
2 | let r1 = delog::logger();
| ^^^^^^^^^^^^^^^
help: <1689> was later invalidated at offsets [0x0..0x10] by a Unique retag
--> src/main.rs:3:14
|
3 | let r2 = delog::logger();
| ^^^^^^^^^^^^^^^
= note: BACKTRACE (of the first span):
= note: inside `main` at src/main.rs:5:28: 5:30
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
error: aborting due to 1 previous error
Hi,
I'm packaging delog for Debian to be able to package solo2-cli some day. Unfortunately it is not very clear to me who the copyright holder of the code is. LICENSE-MIT states "Copyright (c) 2018 John Scarrott" but the first commit in this repository is from 2020 and it seems John Scarrott didn't commit any code. Cargo.toml lists Nicolas Stalder as author.
Could you please clarify and correct? (and also release a new version once fixed?)
Thanks!
Currently, delog
does not support inlined format arguments.
let some_var = "test";
info!("{some_var}");
Should log test
but instead logs {some_var}
without actually formatting it.
Hello,
I am trying to add deluge to my cortex-m0 target using the thumbv6em-none-eabi
toolchain.
Whereas I can compile everything easily with the thumbv7em-none-eabihf
toolchain, the version 6 toolchain does give me the following error:
$ cargo build --target thumbv6em-none-eabi
Compiling delog v0.1.6 (/Users/dominiktacke/Projects/rust/embedded/delog)
error[E0599]: no method named `fetch_add` found for reference `&'static AtomicUsize` in the current scope
--> src/logger.rs:512:29
|
512 | delogger.attempts().fetch_add(1, Ordering::SeqCst);
| ^^^^^^^^^ method not found in `&'static AtomicUsize`
error[E0599]: no method named `fetch_add` found for reference `&'static AtomicUsize` in the current scope
--> src/logger.rs:519:34
|
519 | delogger.successes().fetch_add(1, Ordering::SeqCst);
| ^^^^^^^^^ method not found in `&'static AtomicUsize`
error[E0599]: no method named `compare_exchange` found for reference `&'static AtomicUsize` in the current scope
--> src/logger.rs:538:47
|
538 | let previous = delogger.claimed().compare_exchange(
| ^^^^^^^^^^^^^^^^ method not found in `&'static AtomicUsize`
error[E0599]: no method named `fetch_add` found for reference `&'static AtomicUsize` in the current scope
--> src/logger.rs:587:30
|
587 | delogger.successes().fetch_add(1, Ordering::SeqCst);
| ^^^^^^^^^ method not found in `&'static AtomicUsize`
error[E0599]: no method named `fetch_add` found for reference `&'static AtomicUsize` in the current scope
--> src/logger.rs:599:24
|
599 | delogger.flushes().fetch_add(1, Ordering::SeqCst);
| ^^^^^^^^^ method not found in `&'static AtomicUsize`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `delog` due to 5 previous errors
Tried this on a Mac M1 as well as in the rust:latest docker with the same result.
Ideas are highly appreciated
When logging is compile-time disabled, info!("{}", something)
can trigger a warning that something
is unused, which shouldn't be the case.
When logs are disabled, delog doesn't type check the arguments, which can lead to unexpected compilation if something was only compiled with logs disabled.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.