Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

feat(logging): Migrate to Go structured logging with slog

Abierto
#970 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
go
Área
backend, cli

Línea de trabajo

Comienza inventariando los usos de log.Printf y fmt.Printf en pkg/unikontainers/, pkg/containerd-shim/ y cmd/urunc/, y después inspecciona la ruta de inicio de la CLI para determinar dónde se pueden inicializar los flags. El trabajo estará terminado cuando esas áreas utilicen una configuración centralizada de slog, funcionen los flags de nivel y formato de log, la salida JSON sea válida y el comportamiento no cambie.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

invalid Stale

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

  1. Introduce a centralized logger in pkg/ or internal/ using log/slog.
  2. Replace log.Printf / fmt.Printf logging calls with slog.Info, slog.Debug, slog.Error across:
    • pkg/unikontainers/ (VM lifecycle, network, initrd)
    • pkg/containerd-shim/ (shim operations)
    • cmd/urunc/ (CLI commands)
  3. Add a --log-format flag to urunc CLI supporting text (default) and json.
  4. Add a --log-level flag supporting debug, 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, containerd both use structured logging).
  • Zero external dependencies slog is in the standard library.

Acceptance Criteria

  • slog logger is initialized at program startup with configurable level/format.
  • All existing log calls migrated to structured equivalents.
  • urunc --log-level=debug --log-format=json produces valid JSON logs.
  • No functional behavior changes purely logging migration.

Non-Priorities

  • Adding new logging frameworks (zap, zerolog, etc.)slog only.
  • Changing error handling logic.
  • Adding new features beyond logging.

I can start with pkg/unikontainers/ and then move on from there...

Lenguaje dominante
Go
Estrellas
306
Forks
214
Merge medio
2 d 3 h
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de urunc-dev/urunc

Todos los issues de urunc-dev/urunc

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.