5 unstable releases

0.3.1 May 10, 2023
0.3.0 May 10, 2023
0.2.0-beta May 10, 2023
0.1.1 May 9, 2023
0.1.0 May 9, 2023

#6 in #bunch


Used in packxel

MIT license

16KB
244 lines

Packxel Utils

Shared utils for our packaging utility

View docs

Initializer

use packxel_utils::initializer::PackxelInitializer;
let version = env!("CARGO_PKG_VERSION");
// creates the config and log directories.
let initializer = PackxelInitializer::init("packxel", version);

Logging

use packxel_utils::logging::PackxelLogger;
let initializer = Initializer::init("package-name", "0.0.1");
PackxelLogger::init(initializer);
log::info!("Hello World");

lib.rs:

A bunch of utilities for the packxel project.

Initializer

use packxel_utils::initializer::Initializer;

let version = env!("CARGO_PKG_VERSION");
// creates the config and log directories.
let initializer = Initializer::init("package-name", version);
// the above would create $HOME/.config/package-name
// and logs at $HOME/.config/package-name/logs

Logging

PackxelLogger::init(initializer).unwrap();
// The use log crate from rust-lang
// Writes to $HOME/.config/package-name/logs/packxel.log
// where `package-name` is initializer.name.
log::debug!("Hello World!");
// Run with RUST_LOG=debug cargo run

Dependencies

~1–12MB
~81K SLoC