slog_google/lib.rs
1//! An implemention of [`slog::Drain`](https://slog-rs.github.io/slog/slog/trait.Drain.html) for logging to [Google Cloud](https://cloud.google.com/logging).
2//!
3//! # Usage
4//!
5//! Warning: Currently, this library only works in the context of [workload identity](https://cloud.google.com/iam/docs/workload-identity-federation).
6//!
7//! The `slog_google` drain creates log entries compatible with [Google Cloud Logging](https://cloud.google.com/logging).
8//! Depending on how you want to ship these logs to the Google Logging API, you can choose from one of the available build methods.
9//!
10//! Start by configuring the Logger with the builder ([`Builder`](logger::Builder::new)) and selecting the appropriate build method based on your shipping requirements:
11//!
12//! 1. [`build()`](logger::Builder::build): Receives [`WriteLogEntries`](https://cloud.google.com/logging/docs/reference/v2/rpc/google.logging.v2#google.logging.v2.LoggingServiceV2.WriteLogEntries) over a channel and allows you to handle the transportation manually.
13//! 2. [`build_with_async_shipper()`](logger::Builder::build_with_async_shipper): Offloads transportation to the [`Shipper`](shipper::Shipper) and its sync-async Bridge in an async context. (Requires the `shipper` feature.)
14
15//!
16//! The [`builder`](struct@logger::Builder) supports several `with_*` methods to customize the log message format,
17//! particularly the default labels attached to [log entries](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry).
18//!
19/// slog-google Error types
20pub mod error;
21
22/// The [`slog::Drain`](https://slog-rs.github.io/slog/slog/trait.Drain.html) Implementation of the slog Drain for [Google Cloud Logging](https://cloud.google.com/logging)
23pub mod logger;
24
25/// An optional async process to ship the log for you
26#[cfg(feature = "shipper")]
27pub mod shipper;