Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to approach adding logging timestamps #351

Open
lzap opened this issue Apr 21, 2020 · 0 comments
Open

How to approach adding logging timestamps #351

lzap opened this issue Apr 21, 2020 · 0 comments

Comments

@lzap
Copy link
Contributor

lzap commented Apr 21, 2020

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:

  1. Hacky approach: create STDOUT/STDERR wrappers and change $stdout and $stderr global 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.

  2. Clean but disturbing approach: search and replace puts in the codebase and create a DSL method puts for use in Rakefiles. This looks cleaner, but developers are already used to puts in the codebase. Everytime new line with puts is 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant