|
1 | 1 | use std::{borrow::Cow, sync::Arc};
|
2 | 2 |
|
3 |
| -use crate::{logs::{LogRecord, LogResult}, InstrumentationLibrary, InstrumentationLibraryBuilder, KeyValue}; |
| 3 | +use crate::{ |
| 4 | + logs::{LogRecord, LogResult}, |
| 5 | + InstrumentationLibrary, InstrumentationLibraryBuilder, KeyValue, |
| 6 | +}; |
4 | 7 |
|
5 | 8 | #[cfg(feature = "logs_level_enabled")]
|
6 | 9 | use super::Severity;
|
@@ -114,6 +117,15 @@ pub trait LoggerProvider {
|
114 | 117 | fn logger(&self, name: impl Into<Cow<'static, str>>) -> Self::Logger {
|
115 | 118 | self.logger_builder(name).build()
|
116 | 119 | }
|
| 120 | + |
| 121 | + /// Shuts down this `LoggerProvider` |
| 122 | + /// After shutdown the logger provider cannot be used to create new loggers. |
| 123 | + /// The implementation should propagate the shutdown signal down to ensure no new logs are emitted. |
| 124 | + /// Shutdown the logger provider. Noop logger will be returned after shutdown. |
| 125 | + /// |
| 126 | + /// Note that `shutdown` doesn't mean `Drop`(though `Drop` can call `shutdown`). |
| 127 | + /// It simply means the provider will emit anything in the buffer(if applicable) and stop processing |
| 128 | + fn shutdown(&self) -> Vec<LogResult<()>>; |
117 | 129 | }
|
118 | 130 |
|
119 | 131 | #[derive(Debug)]
|
@@ -145,10 +157,4 @@ impl<'a, T: LoggerProvider + ?Sized> LoggerBuilder<'a, T> {
|
145 | 157 | self.provider
|
146 | 158 | .library_logger(Arc::new(self.library_builder.build()))
|
147 | 159 | }
|
148 |
| - |
149 |
| - /// Shutdown the logger provider. Noop logger will be returned after shutdown. |
150 |
| - /// |
151 |
| - /// Note that `shutdown` doesn't mean `Drop`(though `Drop` can call `shutdown`). |
152 |
| - /// It simply means the provider will emit anything in the buffer(if applicable) and stop processing |
153 |
| - fn shutdown(&self) -> Vec<LogResult<()>>; |
154 | 160 | }
|
0 commit comments