Simple log viewer. Works with log that have json on each line. Works in both Web (WASM) and on native. Defaults are configured for bunyan formatted logs but these are setup as setting and are able to be changed (UI not implemented to change at present due to no demand). For rust programs one can use the crate tracing_bunyan_formatter to generate logs as done in the book Zero To Production In Rust.
You can use the deployed version without install at https://c-git.github.io/log-viewer/
It is expected that the file will contain multiple json objects separated by new lines. If a line is not valid json it can be converted into a Log record with the entire line being one json field. See samples. A toy example would be:
{"v":0,"name":"my_server","msg":"Server address is: 127.0.0.1:8000","level":30,"hostname":"my_computer","pid":42127,"time":"2024-02-10T03:10:25.952130465Z","target":"my_server::startup","line":34,"file":"crates/wic-server/src/startup.rs"}
{"v":0,"name":"my_server","msg":"starting 8 workers","level":30,"hostname":"my_computer","pid":42127,"time":"2024-02-10T03:10:25.952653399Z","target":"actix_server::builder","line":240,"file":"/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.3.0/src/builder.rs"}
{"v":0,"name":"my_server","msg":"Tokio runtime found; starting in existing Tokio runtime","level":30,"hostname":"my_computer","pid":42127,"time":"2024-02-10T03:10:25.952767514Z","target":"actix_server::server","line":197,"file":"/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/actix-server-2.3.0/src/server.rs"}
We do not test on older version of rust so it is possible you may get compilation errors if you are not on the latest version of stable rust.
To get the most recent stable version use rustup update
.
cargo run --release
On Linux you need to first run:
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
On Fedora Rawhide you need to run:
dnf install clang clang-devel clang-tools-extra libxkbcommon-devel pkg-config openssl-devel libxcb-devel gtk3-devel atk fontconfig-devel
You can compile your app to WASM and publish it as a web page.
We use Trunk to build for web target.
- Install the required target with
rustup target add wasm32-unknown-unknown
. - Install Trunk with
cargo install --locked trunk
. - Run
trunk serve
to build and serve onhttp://127.0.0.1:8080
. Trunk will rebuild automatically if you edit the project. - Open
http://127.0.0.1:8080/index.html#dev
in a browser. See the warning below.
assets/sw.js
script will try to cache our app, and loads the cached version when it cannot connect to server allowing your app to work offline (like PWA). appending#dev
toindex.html
will skip this caching, allowing us to load the latest builds during development.
- Just run
trunk build --release
. - It will generate a
dist
directory as a "static html" website - Upload the
dist
directory to any of the numerous free hosting websites including GitHub Pages. - we already provide a workflow that auto-deploys our app to GitHub pages if you enable it.
To enable Github Pages, you need to go to Repository -> Settings -> Pages -> Source -> set to
gh-pages
branch and/
(root).If
gh-pages
is not available inSource
, just create and push a branch calledgh-pages
and it should be available.
You can see the deployed version here https://c-git.github.io/log-viewer/
Built on egui and started from egui template
All code in this repository is dual-licensed under either:
- Apache License, Version 2.0
- MIT license
at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both as noted in this issue on Bevy's repo.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.