Commit a09f8b9 1 parent 3790463 commit a09f8b9 Copy full SHA for a09f8b9
File tree 2 files changed +18
-5
lines changed
2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,9 @@ You can find its changes [documented below](#070---2021-01-01).
61
61
- ` scroll_to_view ` and ` scroll_area_to_view ` methods on ` UpdateCtx ` , ` LifecycleCtx ` and ` EventCtx ` ([ #1976 ] by [ @xarvic ] )
62
62
- ` Notification::route ` ([ #1978 ] by [ @xarvic ] )
63
63
- Build on OpenBSD ([ #1993 ] by [ @klemensn ] )
64
- - Scope: expose scoped state using state() and state_mut() ([ #2082 ] by [ @rjwittams ]
65
- - Tabs: allow getting and setting the tab index of a Tabs widget ([ #2082 ] by [ @rjwittams ]
64
+ - Scope: expose scoped state using state() and state_mut() ([ #2082 ] by [ @rjwittams ] )
65
+ - Tabs: allow getting and setting the tab index of a Tabs widget ([ #2082 ] by [ @rjwittams ] )
66
+ - App: add start_console_logging(bool) which accepts a flag. ([ #2102 ] by [ @ratmice ] )
66
67
67
68
### Changed
68
69
Original file line number Diff line number Diff line change @@ -185,9 +185,17 @@ impl<T: Data> AppLauncher<T> {
185
185
///
186
186
/// # Panics
187
187
///
188
- /// Panics if the subscriber fails to initialize, for example if a `tracing`/`tracing_wasm`
189
- /// global logger was already set.
190
- pub fn log_to_console ( self ) -> Self {
188
+ /// Panics if `enable` is `true` and the subscriber fails to initialize,
189
+ /// for example if a `tracing`/`tracing_wasm` global logger was already set.
190
+ ///
191
+ /// Never panics when `enable` is `false`, or have any other side effect.
192
+ ///
193
+ /// Passing in false is useful if you want to enable a global logger as feature
194
+ /// but log to console otherwise.
195
+ pub fn start_console_logging ( self , enable : bool ) -> Self {
196
+ if !enable {
197
+ return self ;
198
+ }
191
199
#[ cfg( not( target_arch = "wasm32" ) ) ]
192
200
{
193
201
use tracing_subscriber:: prelude:: * ;
@@ -214,6 +222,10 @@ impl<T: Data> AppLauncher<T> {
214
222
self
215
223
}
216
224
225
+ /// Calls `start_console_logging` with `true`.
226
+ pub fn log_to_console ( self ) -> Self {
227
+ self . start_console_logging ( true )
228
+ }
217
229
/// Use custom localization resource
218
230
///
219
231
/// `resources` is a list of file names that contain strings. `base_dir`
You can’t perform that action at this time.
0 commit comments