How to approach adding logging timestamps
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.5k
- Forks
- 650
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Description
Hello,
our customer would like to have optional timestamps for rake output and I would like to contribute this feature if this is feasible. I did some research and it looks like both Rake codebase and Rakefiles use "Kernel.puts" directly. So I have two ideas I would like to discuss before I do any coding:
-
Hacky approach: create STDOUT/STDERR wrappers and change
$stdoutand$stderrglobal variables to these instances. They would add timestamps when configured. Pros: Safe for the future changes because nothing is changing in the codebase. Cons: When Rake is used as a library, changing standard output and error would introduce regressions and problems after upgrade. -
Clean but disturbing approach: search and replace
putsin the codebase and create a DSL methodputsfor use in Rakefiles. This looks cleaner, but developers are already used toputsin the codebase. Everytime new line withputsis added, the output will appear in the output without timestamp. Since this feature would be opt-in, devs will start adding these types kinds of errors pretty soon.
Honestly, I am not sure if I can deliver this feature to my customer but let's discuss and see what you guys think about this. Cheers!
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.
Research direction
Start by reviewing output handling across the Rake codebase and Rakefiles, especially the direct Kernel.puts usage and the proposed STDOUT/STDERR wrapping approach. Determine whether an opt-in timestamp feature can preserve library behavior; done means a feasible design and clear scope have been agreed before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100