-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Feature
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
Description
The current logging implementation in acr-cli relies on fmt.Printf, which lacks structure and flexibility for log management and analysis, not to mention it is locking and thus not great for concurrent use. To improve observability, maintainability, and performance we should use a structured logging. Being most familiar with it and with it being the current most performant go logger, I propose we move to use zerolog https://github.com/rs/zerolog which provides a fast and efficient structured logging library for Go which also provides customizable pretty printing.
Proposed Changes
-
Replace
fmt.Printfwithzerolog- Introduce
zerologas the primary logging mechanism. - Ensure all existing log statements are migrated to structured logs.
- Introduce
-
Add a
--log-levelflag- Allow users to configure the verbosity of logs (
debug,info,warn,error). - Default to
infolevel if not specified.
- Allow users to configure the verbosity of logs (
-
Add a
--log-formatflag- Allow users to choose between
jsonandconsole(human-readable) output formats. - Default to
consolefor CLI usability, but supportjsonfor integration with log aggregation tools.
- Allow users to choose between
-
Enhance Logging for Manifest Purge Logic
- Add detailed logs to indicate:
- Why a manifest is being excluded from purging (Info)
- What criteria were evaluated (Debug)
- Skipped actions due to errors e.g 404 (Warn)
- Add detailed logs to indicate:
Benefits
- Improved debugging and traceability
- Improved performance due to better logging
Tasks
- Add
zerologdependency. - Implement centralized logger setup with configurable log level and format.
- Refactor existing
fmt.Printfcalls to use structured logging. - Add detailed logs around manifest purge decision points.
- Update CLI documentation and usage examples.
Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request