logging: Integrate score_log#73
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
6d93f45 to
c07aed8
Compare
src/kyron/src/io/bridgedfd.rs
Outdated
|
|
||
| use kyron_foundation::prelude::{error, CommonErrors}; | ||
| use crate::macros::k_log::*; | ||
| #[cfg(feature = "score-log")] |
There was a problem hiding this comment.
there must be no ifdefs in code base. It shall be completely hidden from code base
There was a problem hiding this comment.
@pawelrutkaq There are many ifdefs in the code apart from #[cfg(feature = "score-log")]. Do you have any specific reason to remove score_log condition? Do you also want to remove cfg_attr?
#[cfg_attr(feature = "score-log", derive(ScoreDebug))]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct ReadinessState(u32);
There was a problem hiding this comment.
Ye I want that logging system choosing is done in a single place in best case and rest code base does not need to know details about it.
src/kyron/src/io/bridgedfd.rs
Outdated
| }, | ||
| Err(e) => { | ||
| error!("Error reading from mio object: {}", e); | ||
| k_error!("Error reading from mio object: {}", &format!("{}", e)); |
There was a problem hiding this comment.
no strange names, shall be names as usual for log
src/kyron/src/mio/rawfd.rs
Outdated
| fn fmt( | ||
| &self, | ||
| f: &mut dyn kyron_foundation::prelude::ScoreWrite, | ||
| spec: &kyron_foundation::prelude::FormatSpec, |
There was a problem hiding this comment.
export in such a way that original signature is kept. Look into lifecycle repo or persistency.
| drop(_guard); // We need to drop the lock before going into IO wait | ||
|
|
||
| debug!("Parking on IO Driver with timeout: {:?}", timeout); | ||
| k_debug!("Parking on IO Driver with timeout: {:?}", &format!("{:?}", timeout)); |
There was a problem hiding this comment.
why such splits with seeprate format, shall not be like that.
There was a problem hiding this comment.
We get error for not implementing the trait ScoreDebug for Duration and similarly for other types in other places. So, added format() for such instances.
error[E0277]: the trait bound Duration: kyron_foundation::prelude::ScoreDebug is not satisfied
--> src/kyron/src/scheduler/workers/worker_types.rs:165:13
|
165 | k_debug!("Parking on IO Driver with timeout: {:?}", timeout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait kyron_foundation::prelude::ScoreDebug is not implemented for Duration
|
= help: the following other types implement trait kyron_foundation::prelude::ScoreDebug:
&T
&mut T
()
Arc
Box
FromUtf8Error
HashMap<K, V, S>
IoEventInterest
and 35 others
= note: required for Option<Duration> to implement kyron_foundation::prelude::ScoreDebug
note: required by a bound in kyron_foundation::prelude::score_log::score_log_fmt::Placeholder::<'a>::new
--> external/score_baselibs_rust+/src/log/score_log_fmt/fmt.rs:73:4
= note: this error originates in the macro $crate::format_args which comes from the expansion of the macro k_debug (in Nightly builds, run with -Z macro-backtrace for more info)
There was a problem hiding this comment.
We need to implement ScoreDebug for Duration in baselib_rust if not done already.
There was a problem hiding this comment.
We get ScoreDebug trait not implemented error for below items.
1) std::io::Error
2) iceoryx2_cal::event::ListenerWaitError
3) core::net::parser::AddrParseError
4) core::time::Duration
5) std::result::Result<(), kyron_foundation::prelude::CommonErrors>
6) u128
@pawelrutkaq please let me know for which items the ScoreDebug to be implemented in baselibs_rust? I will create ticket accordingly.
There was a problem hiding this comment.
u128, core::time::Duration. kyron_foundation::prelude::CommonErrors in this repo. core::net::parser::AddrParseError in QM part of baselib rust. std::io::Error maybe need local wrapper in this repo to be able to implement trait for it.
There was a problem hiding this comment.
Created ticket eclipse-score/baselibs_rust#74 for u128, Duration and AddrParseError and assigned self.
There was a problem hiding this comment.
Implemented ScoreDebug in baselibs_rust for Duration and AddrParseError, for CommonErrors in kyron-foundation. For other simple cases, to_string() is used instead of implementing ScoreDebug.
For std::result::Result<>, format!() is used since it is only one instance and implementing ScoreDebug with wrapper does not make any difference.
c07aed8 to
487b412
Compare
487b412 to
ab20bb8
Compare
ab20bb8 to
55f9d64
Compare
Integrated score_log under score-log feature with appropriate refactoring in the source code.
55f9d64 to
ccec3dc
Compare
Integrated score_log under score-log feature with appropriate refactoring in the source code.
Notes for Reviewer
Pre-Review Checklist for the PR Author
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #67