Hacker News new | ask | show | jobs
by jesusprubio 2579 days ago
Please, see this response: https://news.ycombinator.com/item?id=20028428

Thank you for the feedback.

Thinking in a CLI, do you think the timestamp is important? I also had this doubt, but it only bothers me.

2 comments

> Thinking in a CLI, do you think the timestamp is important? I also had this doubt, but it only bothers me.

I suppose it depends, and that point was definitely more subjective. My background is as a backend SWE, so most of my work is server-side. When we/I use CLIs, they're often interacting via the network with other services; while sometimes you're watching it, sometimes you're not, and those timestamps provide useful feedback. If you're building a quick and dirty tool, perhaps not.

I do think the comments in that thread — that you should implement as a log crate Log — are correct. Sooner or later Rust will hopefully have a standard logging mechanism, and the log crate looks like it will be it. But your current implementation should, I think, pretty much naturally fit within that. (I think line endings would be the only thing that doesn't; since log will, eventually, have to support emitting to logs that have no concept of a "line ending", it can't really support that.)

One thing you can do is detect whenever stderr is a tty and enable timestamping if not