@@ -31,7 +31,7 @@ use crate::{logs::SdkLogRecord, Resource};
3131
3232#[ cfg( feature = "spec_unstable_logs_enabled" ) ]
3333use opentelemetry:: logs:: Severity ;
34- use opentelemetry:: InstrumentationScope ;
34+ use opentelemetry:: { otel_warn , InstrumentationScope } ;
3535
3636use std:: fmt:: Debug ;
3737use std:: time:: Duration ;
@@ -57,10 +57,21 @@ pub trait LogProcessor: Send + Sync + Debug {
5757 /// Shuts down the processor.
5858 /// After shutdown returns the log processor should stop processing any logs.
5959 /// It's up to the implementation on when to drop the LogProcessor.
60+ ///
61+ /// All implementors should implement this method.
6062 fn shutdown_with_timeout ( & self , _timeout : Duration ) -> OTelSdkResult {
63+ // It would have been better to make this method required, but that ship
64+ // sailed when the logs API was declared stable.
65+ otel_warn ! (
66+ name: "LogProcessor.DefaultShutdownWithTimeout" ,
67+ message = format!( "LogProcessor::shutdown_with_timeout should be implemented by all LogProcessor types" )
68+ ) ;
6169 Ok ( ( ) )
6270 }
6371 /// Shuts down the processor with default timeout.
72+ ///
73+ /// Implementors typically do not need to change this method, and can just
74+ /// implement `shutdown_with_timeout`.
6475 fn shutdown ( & self ) -> OTelSdkResult {
6576 self . shutdown_with_timeout ( Duration :: from_secs ( 5 ) )
6677 }
@@ -140,6 +151,10 @@ pub(crate) mod tests {
140151 fn force_flush ( & self ) -> OTelSdkResult {
141152 Ok ( ( ) )
142153 }
154+
155+ fn shutdown_with_timeout ( & self , _timeout : std:: time:: Duration ) -> OTelSdkResult {
156+ Ok ( ( ) )
157+ }
143158 }
144159
145160 #[ derive( Debug ) ]
@@ -166,6 +181,10 @@ pub(crate) mod tests {
166181 fn force_flush ( & self ) -> OTelSdkResult {
167182 Ok ( ( ) )
168183 }
184+
185+ fn shutdown_with_timeout ( & self , _timeout : std:: time:: Duration ) -> OTelSdkResult {
186+ Ok ( ( ) )
187+ }
169188 }
170189
171190 #[ test]
0 commit comments