1 个不稳定版本
使用旧的 Rust 2015
0.1.0 | 2018 年 10 月 28 日 |
---|
#4 in #standardize
用于 oysterpack
57KB
1K SLoC
在 log 的基础上标准化 OysterPack 平台的日志记录。给定一个 LogConfig,这个包将知道如何初始化和关闭日志系统。
#[macro_use]
extern crate oysterpack_app_metadata_macros;
op_build_mod!();
fn main() {
let app_build = build::get();
oysterpack_log::init(log_config(),&app_build);
// The LogConfig used to initialize the log system can be retrieved.
// This enables the LogConfig to be inspected.
let log_config = oysterpack_log::config().unwrap();
run();
oysterpack_log::shutdown();
}
/// This should be loaded from the app's configuration.
/// For this simple example, we are simply using the default LogConfig.
/// The default LogConfig sets the root log level to Warn and logs to stdout.
fn log_config() -> oysterpack_log::LogConfig {
Default::default()
}
fn run() {}
lib.rs
:
在 log 的基础上标准化 OysterPack 平台的日志记录。给定一个 LogConfig,这个包将知道如何初始化和关闭日志系统。
#[macro_use]
extern crate oysterpack_app_metadata_macros;
op_build_mod!();
fn main() {
let app_build = build::get();
oysterpack_log::init(log_config(),&app_build);
// The LogConfig used to initialize the log system can be retrieved.
// This enables the LogConfig to be inspected.
let log_config = oysterpack_log::config().unwrap();
run();
oysterpack_log::shutdown();
}
/// This should be loaded from the app's configuration.
/// For this simple example, we are simply using the default LogConfig.
/// The default LogConfig sets the root log level to Warn and logs to stdout.
fn log_config() -> oysterpack_log::LogConfig {
Default::default()
}
fn run() {}
依赖
~2.2–7.5MB
~138K SLoC