Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: redirect stderr panic log to rust logger #373

Merged

Conversation

ShootingKing-AM
Copy link
Contributor

@ShootingKing-AM ShootingKing-AM commented Apr 8, 2023

eg. log.

[2023-04-08 19:43:13][�[33mWARN�[0m][aw_transform::flood]: Gap was of negative duration and could NOT be safely merged (-PT397.291Ss). This warning will only show once per batch.
[2023-04-08 19:43:13][�[31mERROR�[0m][panic]: thread 'rocket-worker-thread' panicked at 'meow': aw-transform\src\period_union.rs:49
   0: backtrace::backtrace::trace
   1: backtrace::capture::Backtrace::new
   2: <backtrace::capture::Backtrace as core::default::Default>::default
   3: log_panics::Config::install_panic_hook
   4: alloc::boxed::impl$47::call
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\alloc\src\boxed.rs:2002
   5: std::panicking::rust_panic_with_hook
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\std\src\panicking.rs:696
   6: std::panicking::begin_panic_handler::closure$0
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\std\src\panicking.rs:581
   7: std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\std\src\sys_common\backtrace.rs:150
   8: std::panicking::begin_panic_handler
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\std\src\panicking.rs:579
   9: core::panicking::panic_fmt
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\core\src\panicking.rs:64
  10: aw_transform::period_union::period_union
  11: aw_query::functions::qfunctions::period_union
  12: aw_query::interpret::interpret_prog
  13: aw_query::interpret::interpret_prog
  14: aw_query::interpret::interpret_prog
  15: aw_query::query
  16: aw_server::endpoints::util::<impl core::convert::Into<aw_server::endpoints::util::HttpErrorJson> for aw_datastore::DatastoreError>::into
  17: rocket::server::<impl rocket::rocket::Rocket<rocket::phase::Orbit>>::http_server::{{closure}}::{{closure}}
  18: rocket::server::hyper_service_fn::{{closure}}::{{closure}}
  19: tokio::runtime::task::core::Core<T,S>::poll
  20: tokio::runtime::task::harness::Harness<T,S>::poll
  21: tokio::runtime::scheduler::multi_thread::worker::Context::run
  22: tokio::runtime::scheduler::multi_thread::worker::Context::run
  23: tokio::macros::scoped_tls::ScopedKey<T>::set
  24: tokio::runtime::scheduler::multi_thread::worker::run
  25: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
  26: tokio::runtime::task::core::Core<T,S>::poll
  27: tokio::runtime::task::harness::Harness<T,S>::poll
  28: tokio::runtime::blocking::pool::Inner::run
  29: std::sys_common::backtrace::__rust_begin_short_backtrace
  30: std::thread::Builder::spawn
  31: alloc::boxed::impl$45::call_once
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\alloc\src\boxed.rs:1988
  32: alloc::boxed::impl$45::call_once
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\alloc\src\boxed.rs:1988
  33: std::sys::windows::thread::impl$0::new::thread_start
             at /rustc/1459b3128e288a85fcc4dd1fee7ada2cdcf28794/library\std\src\sys\windows\thread.rs:56
  34: BaseThreadInitThunk
  35: RtlUserThreadStart
  
[2023-04-08 19:43:13][�[31mERROR�[0m][_]: Handler �[37mquery�[0m panicked.
[2023-04-08 19:43:13][�[33mWARN�[0m][_]: A panic is treated as an internal server error.
[2023-04-08 19:43:13][�[33mWARN�[0m][_]: No �[1;34m500�[0m catcher registered. Using Rocket default.

@codecov
Copy link

codecov bot commented Apr 8, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.03 ⚠️

Comparison is base (1f4f07d) 72.84% compared to head (08949c5) 72.81%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #373      +/-   ##
==========================================
- Coverage   72.84%   72.81%   -0.03%     
==========================================
  Files          44       44              
  Lines        2758     2759       +1     
==========================================
  Hits         2009     2009              
- Misses        749      750       +1     
Impacted Files Coverage Δ
aw-server/src/logging.rs 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@johan-bjareholt johan-bjareholt merged commit 49b2026 into ActivityWatch:master Apr 8, 2023
@johan-bjareholt
Copy link
Member

Thanks a lot, was not aware about this crate and looks clean!

@ShootingKing-AM ShootingKing-AM deleted the fix-stderr-log branch April 8, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants