rustfs_obs/
lib.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! # RustFS Observability
16//!
17//! provides tools for system and service monitoring
18//!
19//! ## feature mark
20//!
21//! - `file`: enable file logging enabled by default
22//! - `gpu`: gpu monitoring function
23//! - `kafka`: enable kafka metric output
24//! - `webhook`: enable webhook notifications
25//! - `full`: includes all functions
26//!
27//! to enable gpu monitoring add in cargo toml
28//!
29//! ```toml
30//! # using gpu monitoring
31//! rustfs-obs = { version = "0.1.0", features = ["gpu"] }
32//!
33//! # use all functions
34//! rustfs-obs = { version = "0.1.0", features = ["full"] }
35//! ```
36///
37/// ## Usage
38///
39/// ```no_run
40/// use rustfs_obs::init_obs;
41///
42/// # #[tokio::main]
43/// # async fn main() {
44/// let (logger, guard) = init_obs(None).await;
45/// # }
46/// ```
47mod config;
48mod entry;
49mod global;
50mod logger;
51mod metrics;
52mod sinks;
53mod system;
54mod telemetry;
55mod worker;
56
57pub use config::{AppConfig, LoggerConfig, OtelConfig, SinkConfig};
58pub use entry::args::Args;
59pub use entry::audit::{ApiDetails, AuditLogEntry};
60pub use entry::base::BaseLogEntry;
61pub use entry::unified::{ConsoleLogEntry, ServerLogEntry, UnifiedLogEntry};
62pub use entry::{LogKind, LogRecord, ObjectVersion, SerializableLevel};
63pub use global::*;
64pub use logger::Logger;
65pub use logger::{get_global_logger, init_global_logger, start_logger};
66pub use logger::{log_debug, log_error, log_info, log_trace, log_warn, log_with_context};
67pub use system::SystemObserver;