How to approach adding logging timestamps

Aperta
#351 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
ruby
Ambito
build-system, cli

Direzione di ricerca

Inizia esaminando la gestione dell’output nell’intera codebase di Rake e nei Rakefiles, in particolare l’uso diretto di Kernel.puts e l’approccio proposto di wrapping di STDOUT/STDERR. Determina se una funzionalità di timestamp opt-in può preservare il comportamento della libreria; il lavoro è completo quando, prima dell’implementazione, sono stati concordati un design realizzabile e un ambito chiaro.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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!

Lingua principale
Ruby
Stelle
2.5k
Fork
650
Merge medio
6m
PR unite (30g)
3

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/rake

Tutte le issue di ruby/rake

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.