oma icon indicating copy to clipboard operation
oma copied to clipboard

refactor: refactor to `spdlog-rs` instead of `tracing`

Open NotEvenANeko opened this issue 4 months ago • 15 comments

Refactor tracing to spdlog-rs for logging.

This closes #486 .

cc @SpriteOvO

NotEvenANeko avatar Sep 05 '25 07:09 NotEvenANeko

Initially it looks good, but what I'm wondering is whether we should just replace the tracing family directly with spdlog instead of optional?

eatradish avatar Sep 05 '25 07:09 eatradish

Yeah we should replace tracing with spdlog, current codes is just convenient for debugging. I'll delete the tracing codes after spdlog parts are good to go.

NotEvenANeko avatar Sep 05 '25 07:09 NotEvenANeko

FYI, SpriteOvO/spdlog-rs#93 is merged.

SpriteOvO avatar Sep 17 '25 04:09 SpriteOvO

I'll work on this PR tomorrow.

NotEvenANeko avatar Sep 17 '25 04:09 NotEvenANeko

spdlog-rs is set to main-dev branch now.

NotEvenANeko avatar Sep 19 '25 07:09 NotEvenANeko

FYI, we have just released spdlog-rs v0.5.0. You could target the dependency spdlog-rs in this PR to the crates.io registry now.

SpriteOvO avatar Oct 02 '25 20:10 SpriteOvO

Updated to v0.5.0

NotEvenANeko avatar Oct 02 '25 21:10 NotEvenANeko

Doc tests should be fixed now

NotEvenANeko avatar Oct 05 '25 17:10 NotEvenANeko

Ok I think clippy check is passed now...

NotEvenANeko avatar Oct 13 '25 10:10 NotEvenANeko

Basically LGTM, @eatradish is there anything you are still concerned about?

LGTM, I'll test the functionality tomorrow

eatradish avatar Oct 15 '25 10:10 eatradish

image

80col limit feature is broken

eatradish avatar Oct 16 '25 08:10 eatradish

I'm so sorry for AFK for 3 weeks, I'm busy at study recently so I don't have much time for this, really sorry for this :(

I'm continue this PR now.

After reviewing the code I think that if we can migrate console.rs/src/writer.rs to spdlog-rs? Since the Writer directly use console crate to print the log.

We can migrate all the Writer functions and behavior to OmaFormatter and remove Writer.

Will it be a good idea? 🤔

NotEvenANeko avatar Nov 07 '25 20:11 NotEvenANeko

@NotEvenANeko

We can migrate all the Writer functions and behavior to OmaFormatter and remove Writer.

Will it be a good idea? 🤔

I think putting the behavior "writing to console" into a formatter is not an ideal design. Why don't we just replace the field term: Term in Writer with buf: String, then return it from the formatter?

SpriteOvO avatar Nov 08 '25 06:11 SpriteOvO

Not the print to console behavior, I mean that we can move the formatting part into OmaFormatter, and the printing part is obviously moved to StdStreamSink. However we may need information against terminal, I think we can make an OmaStdoutFormatter to handle terminal-related formatting instead of leaving these parts mixed together in Writer.

NotEvenANeko avatar Nov 13 '25 23:11 NotEvenANeko

Not the print to console behavior, I mean that we can move the formatting part into OmaFormatter, and the printing part is obviously moved to StdStreamSink. However we may need information against terminal, I think we can make an OmaStdoutFormatter to handle terminal-related formatting instead of leaving these parts mixed together in Writer.

I think it's acceptable.

SpriteOvO avatar Nov 16 '25 15:11 SpriteOvO