Skip to content

fix: accept log levels supported by older zot versions, validate configured log level#3639

Merged
andaaron merged 1 commit into
project-zot:mainfrom
andaaron:log2
Dec 12, 2025
Merged

fix: accept log levels supported by older zot versions, validate configured log level#3639
andaaron merged 1 commit into
project-zot:mainfrom
andaaron:log2

Conversation

@andaaron

Copy link
Copy Markdown
Contributor

Accept the same log levels as in https://github.com/rs/zerolog/blob/5391dd7c34c86c2a3b731cd3c3f1b252706e7925/globals.go#L37
This is to maintain backward compatibility with older configurations.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…igured log level

In zot config accept the same log levels as in https://github.com/rs/zerolog/blob/5391dd7c34c86c2a3b731cd3c3f1b252706e7925/globals.go#L37
This is to maintain backward compatibility with other zot version configurations.

Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
@codecov

codecov Bot commented Dec 12, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.50%. Comparing base (08fae91) to head (061989e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/log/log.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3639   +/-   ##
=======================================
  Coverage   91.49%   91.50%           
=======================================
  Files         186      186           
  Lines       26281    26286    +5     
=======================================
+ Hits        24047    24053    +6     
+ Misses       1445     1444    -1     
  Partials      789      789           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances log level handling to maintain backward compatibility with older zot versions that used zerolog. It adds support for additional log levels ("trace", "fatal", "panic") and improves error handling by validating log levels before logger creation.

Key Changes:

  • Adds support for "trace", "fatal", and "panic" log levels to match zerolog's supported levels
  • Makes ParseLevel function public for external validation
  • Adds early validation in configuration loading to provide clear error messages instead of panics

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pkg/log/log.go Adds new log level aliases (trace→debug, fatal/panic→error), makes ParseLevel public, and improves error messages with list of supported levels
pkg/cli/server/root.go Adds log level validation before logger creation to prevent panics and provide better error messages
pkg/cli/server/root_test.go Adds tests for invalid log level validation and the new "trace" log level support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cli/server/root.go
Comment thread pkg/log/log.go
@andaaron
andaaron merged commit 1447bb2 into project-zot:main Dec 12, 2025
50 of 55 checks passed
@andaaron
andaaron deleted the log2 branch December 12, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants