-
Notifications
You must be signed in to change notification settings - Fork 44
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.Printf
withzerolog
- Introduce
zerolog
as the primary logging mechanism. - Ensure all existing log statements are migrated to structured logs.
- Introduce
-
Add a
--log-level
flag- Allow users to configure the verbosity of logs (
debug
,info
,warn
,error
). - Default to
info
level if not specified.
- Allow users to configure the verbosity of logs (
-
Add a
--log-format
flag- Allow users to choose between
json
andconsole
(human-readable) output formats. - Default to
console
for CLI usability, but supportjson
for 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
zerolog
dependency. - Implement centralized logger setup with configurable log level and format.
- Refactor existing
fmt.Printf
calls 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