An open API service indexing awesome lists of open source software.

https://github.com/pinax-network/substreams-sink-winston

Substreams Winston Logger sink module
https://github.com/pinax-network/substreams-sink-winston

pinax substreams thegraph winston

Last synced: 13 days ago
JSON representation

Substreams Winston Logger sink module

Awesome Lists containing this project

README

        

# [`Substreams`](https://substreams.streamingfast.io/) [Winston](https://github.com/winstonjs/winston) `Logger` sink module

[github](https://github.com/pinax-network/substreams-sink-winston)
[crates.io](https://crates.io/crates/substreams-sink-winston)
[docs.rs](https://docs.rs/substreams-sink-winston)
[GitHub Workflow Status](https://github.com/pinax-network/substreams-sink-winston/actions?query=branch%3Amain)

> `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](https://tools.ietf.org/html/rfc5424).

## 📖 Documentation

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

### Further resources

- [Substreams documentation](https://substreams.streamingfast.io)
- [Winston documentation](https://github.com/winstonjs/winston)

## Related Sinks

- [ ] **Substreams GoogleSheet** sink module
- [ ] **Substreams CSV** sink module
- [ ] **Substreams Telegram** sink module
- [ ] **Substreams Discord** sink module

## 🛠 Feature Roadmap

### Create Logger
- [x] service
- [ ] defaultMeta

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

### Filtering info Objects
- [ ] ~ignorePrivate~
- [ ] ~private~

## Install

```bash
$ cargo add substreams-sink-winston
```

## Quickstart

**Cargo.toml**

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

**src/lib.rs**

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

#[substreams::handlers::map]
fn prom_out(
... some stores ...
) -> Result {
// 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)
}
```