@@ -14,6 +14,7 @@ use lambda_platform::winit::{
1414 Loop ,
1515 LoopBuilder ,
1616} ;
17+ #[ macro_use]
1718use logging:: {
1819 handler:: ConsoleHandler ,
1920 Logger ,
@@ -155,9 +156,6 @@ impl Runtime<(), String> for ApplicationRuntime {
155156 render_context,
156157 } = self ;
157158
158- let mut runtime_logger =
159- Logger :: new ( logging:: LogLevel :: TRACE , name. clone ( ) ) ;
160- runtime_logger. add_handler ( Box :: new ( ConsoleHandler :: new ( name. clone ( ) ) ) ) ;
161159 let mut active_render_context = Some ( render_context) ;
162160
163161 let publisher = event_loop. create_event_publisher ( ) ;
@@ -239,10 +237,9 @@ impl Runtime<(), String> for ApplicationRuntime {
239237 } )
240238 }
241239 _ => {
242- runtime_logger. warn (
243- format ! ( "[WARN] Unhandled synthetic keyboard event: {:?}" ,
244- input)
245- ) ;
240+ logging:: info!(
241+ "[INFO] Unhandled synthetic keyboard event: {:?}" ,
242+ input) ;
246243 None
247244 }
248245 } ,
@@ -352,7 +349,7 @@ impl Runtime<(), String> for ApplicationRuntime {
352349 WinitEvent :: UserEvent ( lambda_event) => match lambda_event {
353350 Events :: Runtime { event, issued_at } => match event {
354351 RuntimeEvent :: Initialized => {
355- runtime_logger . info ( format ! ( "Initializing all of the components for the runtime: {}" , name) ) ;
352+ logging :: info!( "Initializing all of the components for the runtime: {}" , name) ;
356353 for component in & mut component_stack {
357354 component. on_attach ( active_render_context. as_mut ( ) . unwrap ( ) ) ;
358355 }
@@ -382,22 +379,22 @@ impl Runtime<(), String> for ApplicationRuntime {
382379 . destroy ( ) ;
383380
384381
385- runtime_logger . info ( String :: from ( "All resources were successfully deleted." ) ) ;
382+ logging :: info! ( "All resources were successfully deleted." ) ;
386383 None
387384 }
388385 } ;
389386
390387 match mapped_event {
391388 Some ( event) => {
392- runtime_logger . trace ( format ! ( "Sending event: {:?} to all components" , event) ) ;
389+ logging :: trace!( "Sending event: {:?} to all components" , event) ;
393390
394391 for component in & mut component_stack {
395392 let event_result = component. on_event ( event. clone ( ) ) ;
396393 match event_result {
397394 Ok ( _) => { }
398395 Err ( e) => {
399396 let error = format ! ( "[ERROR] A component has panicked while handling an event. {:?}" , e) ;
400- runtime_logger . error ( error . clone ( ) ) ;
397+ logging :: error! ( "A component has panicked while handling an event. {:?}" , e ) ;
401398 publisher. publish_event ( Events :: Runtime { event : RuntimeEvent :: ComponentPanic { message : error} , issued_at : Instant :: now ( ) } ) ;
402399 }
403400 }
@@ -412,10 +409,10 @@ impl Runtime<(), String> for ApplicationRuntime {
412409 /// When an application runtime starts, it will attach all of the components that
413410 /// have been added during the construction phase in the users code.
414411 fn on_start ( & mut self ) {
415- println ! ( "[INFO] Starting the runtime {}" , self . name) ;
412+ logging :: info !( "Starting the runtime: {}" , self . name) ;
416413 }
417414
418415 fn on_stop ( & mut self ) {
419- println ! ( "[INFO] Stopping {}" , self . name)
416+ logging :: info !( "Stopping the runtime: {}" , self . name) ;
420417 }
421418}
0 commit comments