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
- Host: GitHub
- URL: https://github.com/pinax-network/substreams-sink-winston
- Owner: pinax-network
- License: apache-2.0
- Archived: true
- Created: 2023-02-18T02:12:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-20T19:49:49.000Z (about 2 years ago)
- Last Synced: 2025-04-03T06:02:36.426Z (about 2 months ago)
- Topics: pinax, substreams, thegraph, winston
- Language: Rust
- Homepage: https://docs.rs/substreams-sink-winston
- Size: 43.9 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-substreams - Winston Sink - Logger sink module. (Substreams Sinks / Firehose)
README
# [`Substreams`](https://substreams.streamingfast.io/) [Winston](https://github.com/winstonjs/winston) `Logger` sink module
[
](https://github.com/pinax-network/substreams-sink-winston)
[](https://crates.io/crates/substreams-sink-winston)
[](https://docs.rs/substreams-sink-winston)
[](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)
}
```