Expand description
§About
Examplify is a lightweight logging UI for Rust web applications. It uses the
log facade and adds a searchable, filterable
console overlay to WebAssembly apps. On native targets, it forwards log records
to env_logger.
Its primary motivation is to provide an ultra-simple way for libraries to show
examples/ in the web without having to stitch together js-sys or possibly a
much heavier crate like eframe.
§Usage
use examplify::log;
fn main() {
examplify::init().with_log_level(log::LevelFilter::Info);
log::info!("Application started");
log::warn!("Something needs attention");
}examplify::init() installs the logger for the current target. If another
logger might already be installed, use examplify::try_init() to handle that
case:
if let Err(error) = examplify::try_init() {
eprintln!("Could not install Examplify logger: {error}");
}§License
Dual-licensed under the MIT License and the Apache License, Version 2.0. Choose whichever you prefer. This license only applies to Examplify code.
By submitting a contribution, including code submitted through a pull request, you agree that your contribution will be dual-licensed under the MIT License and the Apache License, Version 2.0, without any additional terms or conditions.
Re-exports§
pub use log;
Structs§
- Init
- Handle for configuring the logger after calling
init. - LogEntry
- A captured log record, including its level and source metadata when available.
Constants§
- MAX_
LOG_ ENTRIES - Maximum number of recent log records retained in memory.
Functions§
- clear
- Remove all currently captured records and clear the browser console when running in browser WebAssembly.
- entries
- Return a snapshot of the recent captured records, oldest first.
- init
- Install Examplify’s logger for the current platform.
- try_
init - Fallible version of
init, useful when another global logger may already be installed.