[][src]Crate oysterpack

This crate defines the public framework API for the OysterPack platform. This crate curates the OysterPack modules in a central location.

Getting started

#[macro_use]
extern crate oysterpack;

use oysterpack::log;

// gathers build time info for this crate
op_build_mod!();

fn main() {
    // get the app's build info that was gathered during compilation
    let app_build = build::get();

    // initialize the log system
    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 = log::config().unwrap();

    run();

    // shutdown the logging system
    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() -> log::LogConfig {
    Default::default()
}

fn run() {
    // the log macros were re-exported by oysterpack
    info!("running ...");
}

Re-exports

pub extern crate oysterpack_app_metadata as app_metadata;
pub extern crate oysterpack_app_metadata_macros;
pub extern crate oysterpack_log as log;
pub extern crate oysterpack_macros;
pub extern crate oysterpack_uid as uid;
pub extern crate chrono;
pub extern crate semver;
pub extern crate serde;
pub extern crate serde_derive;

Macros

debug

Logs a message at the debug level.

error

Logs a message at the error level.

info

Logs a message at the info level.

log

The standard logging macro.

log_enabled

Determines if a message logged at the specified level in that module will be logged.

op_build_mod

Generates a public module which includes build-time info generated via oysterpack_built.

op_newtype

Defines a new type for the specified type.

op_tt_as_expr

Used to coerce tt tokens into an expr

op_tt_as_item

Used to coerce a tt tokens into an item

op_tt_as_pat

Used to coerce a tt tokens into a pat

op_tt_as_stmt

Used to coerce a tt tokens into a stmt

trace

Logs a message at the trace level.

warn

Logs a message at the warn level.