File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 50
50
//! // ..
51
51
//! }
52
52
//! ```
53
+ //!
54
+ //! ## Example with a custom log formatter
55
+ //!
56
+ //! ```
57
+ //! use android_logger::Config;
58
+ //!
59
+ //! android_logger::init_once(
60
+ //! Config::default()
61
+ //! .with_min_level(log::Level::Trace)
62
+ //! .format(|f, record| write!(f, "my_app: {}", record.args()))
63
+ //! )
64
+ //! ```
53
65
54
66
#[ cfg( target_os = "android" ) ]
55
67
extern crate android_log_sys as log_ffi;
@@ -240,6 +252,15 @@ impl Config {
240
252
self
241
253
}
242
254
255
+ /// Sets the format function for formatting the log output.
256
+ /// ```
257
+ /// # use android_logger::Config;
258
+ /// android_logger::init_once(
259
+ /// Config::default()
260
+ /// .with_min_level(log::Level::Trace)
261
+ /// .format(|f, record| write!(f, "my_app: {}", record.args()))
262
+ /// )
263
+ /// ```
243
264
pub fn format < F > ( mut self , format : F ) -> Self
244
265
where
245
266
F : Fn ( & mut dyn fmt:: Write , & Record ) -> fmt:: Result + Sync + Send + ' static ,
You can’t perform that action at this time.
0 commit comments