Skip to content

Commit

Permalink
Rename to slog-google
Browse files Browse the repository at this point in the history
  • Loading branch information
robklg committed Dec 15, 2024
1 parent 6269cb8 commit 8a161b8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ documentation = "https://github.com/bolcom/unFTP"
path = "crates/redislog"
version = "0.1.2"

[dependencies.googlelog]
[dependencies.slog-google]
path = "crates/googlelog"
features = ["shipper"]
version = "0.1.0"
Expand Down
7 changes: 6 additions & 1 deletion crates/googlelog/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[package]
name = "googlelog"
name = "slog-google"
description = "Google Logging drain for slog-rs"
version = "0.1.0"
edition = "2021"
authors = [
"Rob klein Gunnewiek <[email protected]>"
]
keywords = ["slog", "logging", "log", "google", "gcp"]
categories = ["development-tools::debugging"]
homepage = "https://github.com/bolcom/unFTP/tree/master/crates/googlelog"
repository = "https://github.com/bolcom/unFTP/tree/master/crates/googlelog"

[features]
shipper = []
Expand Down
4 changes: 2 additions & 2 deletions crates/googlelog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//!
//! Warning: Currently, this library only works in the context of [workload identity](https://cloud.google.com/iam/docs/workload-identity-federation).
//!
//! The `googlelog` drain creates log entries compatible with [Google Cloud Logging](https://cloud.google.com/logging).
//! The `slog_google` drain creates log entries compatible with [Google Cloud Logging](https://cloud.google.com/logging).
//! Depending on how you want to ship these logs to the Google Logging API, you can choose from one of the available build methods.
//!
//! Start by configuring the Logger with the builder ([`Builder`](logger::Builder::new)) and selecting the appropriate build method based on your shipping requirements:
Expand All @@ -16,7 +16,7 @@
//! The [`builder`](struct@logger::Builder) supports several `with_*` methods to customize the log message format,
//! particularly the default labels attached to [log entries](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry).
//!
/// Googlelog Error types
/// slog-google Error types
pub mod error;

/// 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)
Expand Down
6 changes: 3 additions & 3 deletions crates/googlelog/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Builder {
/// # Example
///
/// ```
/// use googlelog::logger::Builder;
/// use slog_google::logger::Builder;
/// let (drain, _) = Builder::new(
/// "projects/my-gcp-project/logs/my-log-id",
/// "k8s_container",
Expand Down Expand Up @@ -81,7 +81,7 @@ impl Builder {
/// "namespace_name": "my-gke-namespace"
/// });
///
/// use googlelog::logger::Builder;
/// use slog_google::logger::Builder;
/// let (drain, _) = Builder::new(
/// "projects/my-gcp-project/logs/my-log-id",
/// "k8s_container",
Expand Down Expand Up @@ -195,7 +195,7 @@ impl Builder {
/// "namespace_name": "my-gke-namespace"
/// });
///
/// use googlelog::logger::Builder;
/// use slog_google::logger::Builder;
/// let (drain, mut shipper) = Builder::new(
/// "projects/my-gcp-project/logs/my-log-id",
/// "k8s_container",
Expand Down
6 changes: 3 additions & 3 deletions src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ where

pub fn create_logger(
arg_matches: &ArgMatches,
) -> Result<(slog::Logger, Option<googlelog::shipper::Shipper>), String> {
) -> Result<(slog::Logger, Option<slog_google::shipper::Shipper>), String> {
let min_log_level = match arg_matches.occurrences_of(VERBOSITY) {
0 => Level::Warning,
1 => Level::Info,
Expand Down Expand Up @@ -140,7 +140,7 @@ fn load_labels_file(file_path: &str, hostname: &str) -> Result<serde_json::Value

fn google_logger(
m: &ArgMatches,
) -> Result<Option<(googlelog::logger::Logger, googlelog::shipper::Shipper)>, String> {
) -> Result<Option<(slog_google::logger::Logger, slog_google::shipper::Shipper)>, String> {
match (m.value_of(GLOG_LOGNAME), m.value_of(GLOG_RESOURCE_TYPE)) {

(Some(logname), Some(resource_type)) => {
Expand All @@ -150,7 +150,7 @@ fn google_logger(

let (labels_file, level_label) = (m.value_of(GLOG_LABELS_FILE), m.value_of(GLOG_LEVEL_LABEL));

let mut builder = googlelog::logger::Builder::new(
let mut builder = slog_google::logger::Builder::new(
logname,
resource_type,
);
Expand Down

0 comments on commit 8a161b8

Please sign in to comment.