rename rustfs-logging to rustfs-obs

This commit is contained in:
houseme
2025-03-09 10:47:03 +08:00
parent 4ecb53c526
commit bcab86fc38
8 changed files with 181 additions and 32 deletions
@@ -1,5 +1,5 @@
[package]
name = "rustfs-logging"
name = "rustfs-obs"
edition.workspace = true
license.workspace = true
repository.workspace = true
@@ -23,7 +23,7 @@ use tokio::sync::mpsc;
/// * `span_id` - The span ID of the event
/// # Example
/// ```
/// use rustfs_logging::AuditEntry;
/// use rustfs_obs::AuditEntry;
/// let entry = AuditEntry {
/// version: "1.0".to_string(),
/// event_type: "read".to_string(),
@@ -63,7 +63,7 @@ impl AuditTarget for FileAuditTarget {
///
/// # Example
/// ```
/// use rustfs_logging::{AuditEntry, AuditTarget, FileAuditTarget};
/// use rustfs_obs::{AuditEntry, AuditTarget, FileAuditTarget};
/// let entry = AuditEntry {
/// version: "1.0".to_string(),
/// event_type: "read".to_string(),
@@ -88,7 +88,7 @@ impl AuditTarget for FileAuditTarget {
/// * `url` - The URL of the webhook
/// # Example
/// ```
/// use rustfs_logging::WebhookAuditTarget;
/// use rustfs_obs::WebhookAuditTarget;
/// let target = WebhookAuditTarget::new("http://localhost:8080");
/// ```
pub struct WebhookAuditTarget {
@@ -126,7 +126,7 @@ impl AuditTarget for WebhookAuditTarget {
/// * `topic` - The Kafka topic
/// # Example
/// ```
/// use rustfs_logging::KafkaAuditTarget;
/// use rustfs_obs::KafkaAuditTarget;
/// let target = KafkaAuditTarget::new("localhost:9092", "rustfs-audit");
/// ```
/// # Note
@@ -135,7 +135,7 @@ impl AuditTarget for WebhookAuditTarget {
/// ```toml
/// [dependencies]
/// rdkafka = "0.26.0"
/// rustfs_logging = { version = "0.1.0", features = ["audit-kafka"] }
/// rustfs_obs = { version = "0.1.0", features = ["audit-kafka"] }
/// ```
/// # Note
/// The `rdkafka` crate requires the `librdkafka` library to be installed
@@ -214,7 +214,7 @@ impl AuditTarget for KafkaAuditTarget {
///
/// # Example
/// ```
/// use rustfs_logging::{AuditEntry, AuditLogger, FileAuditTarget};
/// use rustfs_obs::{AuditEntry, AuditLogger, FileAuditTarget};
///
/// #[tokio::main]
/// async fn main() {
@@ -238,7 +238,7 @@ impl AuditTarget for KafkaAuditTarget {
/// to multiple targets
/// # Example
/// ```
/// use rustfs_logging::{AuditEntry, AuditLogger, FileAuditTarget};
/// use rustfs_obs::{AuditEntry, AuditLogger, FileAuditTarget};
/// let logger = AuditLogger::new(vec![Box::new(FileAuditTarget)]);
/// ```
/// # Note
@@ -247,7 +247,7 @@ impl AuditTarget for KafkaAuditTarget {
/// ```toml
/// [dependencies]
/// tokio = { version = "1", features = ["full"] }
/// rustfs_logging = { version = "0.1.0"}
/// rustfs_obs = { version = "0.1.0"}
/// ```
/// # Note
/// This feature requires the `serde` crate
@@ -255,7 +255,7 @@ impl AuditTarget for KafkaAuditTarget {
/// ```toml
/// [dependencies]
/// serde = { version = "1", features = ["derive"] }
/// rustfs_logging = { version = "0.1.0"}
/// rustfs_obs = { version = "0.1.0"}
/// ```
pub struct AuditLogger {
tx: mpsc::Sender<AuditEntry>,
@@ -270,7 +270,7 @@ impl AuditLogger {
/// * An AuditLogger
/// # Example
/// ```
/// use rustfs_logging::{AuditLogger, AuditEntry, FileAuditTarget};
/// use rustfs_obs::{AuditLogger, AuditEntry, FileAuditTarget};
///
/// let logger = AuditLogger::new(vec![Box::new(FileAuditTarget)]);
/// ```
@@ -291,7 +291,7 @@ impl AuditLogger {
/// * `entry` - The audit entry to log
/// # Example
/// ```
/// use rustfs_logging::{AuditEntry, AuditLogger, FileAuditTarget};
/// use rustfs_obs::{AuditEntry, AuditLogger, FileAuditTarget};
///
/// #[tokio::main]
/// async fn main() {
@@ -5,7 +5,7 @@
///
/// # Examples
/// ```
/// use rustfs_logging::{log_info, log_error};
/// use rustfs_obs::{log_info, log_error};
///
/// log_info("This is an informational message");
/// log_error("This is an error message");
@@ -24,7 +24,7 @@ mod telemetry;
#[cfg(test)]
mod tests {
use super::*;
use crate::{log_info, AuditEntry, AuditLogger, AuditTarget, FileAuditTarget, Telemetry};
use chrono::Utc;
use opentelemetry::global;
use opentelemetry::trace::{TraceContextExt, Tracer};
@@ -7,7 +7,7 @@ use tracing::{debug, error, info};
///
/// # Example
/// ```
/// use rustfs_logging::log_info;
/// use rustfs_obs::log_info;
///
/// log_info("This is an info message");
/// ```
@@ -22,7 +22,7 @@ pub fn log_info(msg: &str) {
///
/// # Example
/// ```
/// use rustfs_logging::log_error;
/// use rustfs_obs::log_error;
///
/// log_error("This is an error message");
/// ```
@@ -37,7 +37,7 @@ pub fn log_error(msg: &str) {
///
/// # Example
/// ```
/// use rustfs_logging::log_debug;
/// use rustfs_obs::log_debug;
///
/// log_debug("This is a debug message");
/// ```
@@ -25,7 +25,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilte
///
/// # Example
/// ```
/// use rustfs_logging::Telemetry;
/// use rustfs_obs::Telemetry;
///
/// let _telemetry = Telemetry::init();
/// ```