1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! # OpenTelemetry Log Integration
//!
//! This crate provides integration with OpenTelemetry for logging purposes. It allows you to
//! initialize and manage loggers that are compatible with the OpenTelemetry SDK.
//!
//! ## Features
//!
//! - Initialize loggers with specific tags, levels, and exporter endpoints.
//! - Automatically manage the lifecycle of loggers, ensuring proper shutdown.
//!
//! ## Usage
//!
//! Add this crate to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! opentelemetry-log = "0.1"
//! ```
//!
//! Import and use the `Opentelemetry` struct to manage your loggers:
//!
//! ```rust
//! use opentelemetry_log::Opentelemetry;
//!
//! #[tokio::main]
//! async fn main() {
//! let mut otel = Opentelemetry::new();
//! otel.init_log("my_app", "info", "http://localhost:4317").unwrap(); // Please do not unwrap in production code
//! // Your application logic here
//! }
//! ```
//!
//! ## Modules
//!
//! - `log`: Contains the log initialization logic.
//!
//! ## Structs
//!
//! - `Opentelemetry`: Main struct for managing OpenTelemetry loggers.
//!
//! ## Traits
//!
//! - `Default`: Provides a default implementation for `Opentelemetry`.
//! - `Drop`: Ensures proper shutdown of loggers when `Opentelemetry` instances are dropped.
//!
//! ## Errors
//!
//! This crate uses the `anyhow` crate for error handling. Ensure you handle errors appropriately
//! when initializing and using loggers.
pub use anyhow;
use Arc;
use logs as sdklogs;
/// Main struct for managing OpenTelemetry loggers, when you init the logger
/// remember to keep this alive for all the lifetime of the application.
///
/// An example can be found in the `examples` directory.