feat(logging): Migrate to Go structured logging with slog
Maintainer thường phản hồi trong vòng 1 ngày
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
- 35/100
Hướng nghiên cứu
Trước tiên, hãy kiểm kê các chỗ sử dụng log.Printf và fmt.Printf trong pkg/unikontainers/, pkg/containerd-shim/ và cmd/urunc/, sau đó kiểm tra luồng khởi động CLI để xác định nơi có thể khởi tạo các flag. Công việc hoàn tất khi các khu vực đó sử dụng thiết lập slog tập trung, các flag về mức log và định dạng log hoạt động, đầu ra JSON hợp lệ và hành vi không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
urunc currently uses standard Go logging (log package or fmt.Printf) throughout the codebase. This produces unstructured, plain-text logs that are difficult to filter, query, or aggregate in production deployments.
Go 1.21 introduced log/slog, the standard structured logging package. Migrating to slog would enable leveled logging (Debug, Info, Warn, Error), structured key-value pairs, and JSON output.... all without external dependencies.
Proposed Work
- Introduce a centralized logger in
pkg/orinternal/usinglog/slog. - Replace
log.Printf/fmt.Printflogging calls withslog.Info,slog.Debug,slog.Erroracross:pkg/unikontainers/(VM lifecycle, network, initrd)pkg/containerd-shim/(shim operations)cmd/urunc/(CLI commands)
- Add a
--log-formatflag touruncCLI supportingtext(default) andjson. - Add a
--log-levelflag supportingdebug,info,warn,error.
Why This Matters
- Structured logs enable filtering and aggregation in production (e.g., "show all ERROR logs from network setup").
- JSON output integrates with log aggregation systems (ELK, Loki, CloudWatch).
- Aligns with modern Go practices (
runc,containerdboth use structured logging). - Zero external dependencies
slogis in the standard library.
Acceptance Criteria
-
sloglogger is initialized at program startup with configurable level/format. - All existing log calls migrated to structured equivalents.
-
urunc --log-level=debug --log-format=jsonproduces valid JSON logs. - No functional behavior changes purely logging migration.
Non-Priorities
- Adding new logging frameworks (zap, zerolog, etc.)
slogonly. - Changing error handling logic.
- Adding new features beyond logging.
I can start with pkg/unikontainers/ and then move on from there...
- Ngôn ngữ chính
- Go
- Star
- 306
- Fork
- 214
- Merge trung bình
- 2 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của urunc-dev/urunc
-
Containers handed over to runc cannot be started, killed or deleted when urunc runs without --rootCó thể đã có người làm @Daksha1611 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
urunc-dev/urunc#1127 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
urunc-deploy cleanup never labels the node, so the cleanup DaemonSet does not runCó thể đã có người làm @Sarthak-Shreshtha01 đã nhận 5 ngày trước. Đang mởbug K8s/Tools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
FreeBSD: docs update and rootfs detectionCó thể đã có người làm @yug105 đã nhận 2 ngày trước. Đang mởdocumentation enhancement Storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
urunc-dev/urunc#1108 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Rumprun guests receive &, < and > as \u0026, \u003c and \u003eCó thể đã có người làm @Sarthak-Shreshtha01 đã nhận 11 ngày trước. Đang mởbug Guests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
urunc-dev/urunc#1074 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hooks run concurrently instead of in the listed orderCó thể làm lại được @anishmehta24 đã nhận 16 ngày trước và không có pull request nào đang mở. Đang mởCore enhancement OCI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
urunc-dev/urunc#1066 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của urunc-dev/urunc
Issue tương tự
-
automation models
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
mvanhorn/cli-printing-press#5146 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.jsonc files are skippedĐang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
alibaba/open-code-review#1800 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kind/engineering needs-triage pulumi/registry R2 S2 Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày