substreams-sink-winston

Crates.iosubstreams-sink-winston
lib.rssubstreams-sink-winston
version0.1.2
sourcesrc
created_at2023-02-18 22:26:10.879675
updated_at2023-02-20 19:38:44.674377
descriptionSubstreams Winston Logger sink module
homepagehttps://github.com/pinax-network/substreams-sink-winston
repositoryhttps://github.com/pinax-network/substreams-sink-winston
max_upload_size
id788504
size45,882
Denis (DenisCarriere)

documentation

README

Substreams Winston Logger sink module

github crates.io docs.rs GitHub Workflow Status

substreams-sink-winston is a tool that allows developers to pipe data extracted metrics from a blockchain into a standard Winston Logging message conforming to the severity ordering specified by RFC5424.

📖 Documentation

https://docs.rs/substreams-sink-winston

Further resources

Related Sinks

  • Substreams GoogleSheet sink module
  • Substreams CSV sink module
  • Substreams Telegram sink module
  • Substreams Discord sink module

🛠 Feature Roadmap

Create Logger

  • service
  • defaultMeta

Logging

  • Emergency: system is unusable
  • Alert: action must be taken immediately
  • Critical: critical conditions
  • Error: error conditions
  • Warning: warning conditions
  • Notice: normal but significant condition
  • Informational: informational messages
  • Debug: debug-level messages

Filtering info Objects

  • ignorePrivate
  • private

Install

$ cargo add substreams-sink-winston

Quickstart

Cargo.toml

[dependencies]
substreams = "0.5"
substreams-sink-winston = "0.1"

src/lib.rs

use substreams::errors::Error;
use substreams_sink_winston::{Logger, LoggerOperations};

#[substreams::handlers::map]
fn prom_out(
    ... some stores ...
) -> Result<LoggerOperations, Error> {
    // Initialize Winston Logger operations container
    let mut log_ops: LoggerOperations = Default::default();

    // Create Logger
    // ==============
    let mut logger = Logger::from("user-service");

    // Informational: informational messages
    log_ops.push(logger.info("info message"));

    // Error: error conditions
    log_ops.push(logger.error("error message"));

    // Include Metadata
    let meta = Meta::from(vec!(["key", "value"]));
    log_ops.push(logger.info("message").with(meta));

    Ok(log_ops)
}
Commit count: 25

cargo fmt