oxidecomputer / oxidecomputer/opte
function `dbg` is never used
Open
@rzezeski is already working on this.
Since Aug 30, 2022.
- Dominant language
- Rust
- Stars
- 77
- Forks
- 11
- Avg merge
- 9d 20h
- Merged PRs (30d)
- 8
Description
I'm sick of seeing this warning:
warning: function `dbg` is never used
--> src/engine/mod.rs:146:12
|
146 | fn dbg<S: AsRef<str> + fmt::Display>(msg: S) {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
- xde is the only consumer of
opte::engine::dbg(). - This is leftover from older days. The
dbg()function is no longer of use to generic opte: instead this should be replaced withLogProvider::log(). - The
log()method should grow the ability to only log when logging is enabled and the level of the message is higher or equal to the level set. This would be controlled dynamically on a per-port basis, through an ioctl cmd. This allows full control of what gets written to the system console. This is important because depending on what log messages we add to the code we could flood the system log with error messages when a port has a bad configuration and a high rate of traffic. I would argue that actually writing to the system log should be a last resort, which leads me to the next bullet. - Add an SDT probe to the
log()method that allows one to trace all log messages all the time (i.e., regardless of current enabled level). Make sure to create the SDT probe in a way that allows easy filtering on port name, direction, and log level. This allows one to dynamically inspect logging messages without any need to actually write them to the system log. - The same goes for
opte::engine::err(), it should use the log provider.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.