How to approach adding logging timestamps

Đang mở
#351 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
ruby
Lĩnh vực
build-system, cli

Hướng nghiên cứu

Bắt đầu bằng việc xem xét cách xử lý đầu ra trên toàn bộ codebase của Rake và các Rakefiles, đặc biệt là việc sử dụng trực tiếp Kernel.puts và cách tiếp cận wrapping STDOUT/STDERR được đề xuất. Xác định liệu một tính năng timestamp opt-in có thể duy trì hành vi của thư viện hay không; được xem là hoàn tất khi một thiết kế khả thi và phạm vi rõ ràng đã được thống nhất trước khi triển khai.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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!

Ngôn ngữ chính
Ruby
Star
2.5k
Fork
650
Merge trung bình
6 phút
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby/rake

Tất cả issue của ruby/rake

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.