Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow new log levels #63

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/site_encrypt.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ defmodule SiteEncrypt do
@doc "Invoked after the new certificate has been obtained."
@callback handle_new_cert() :: any

log_levels =
if Version.compare(System.version(), "1.11.0") in [:gt, :eq] do
[:error, :info, :debug, :emergency, :alert, :critical, :warning, :notice]
else
[:debug, :info, :warn, :error]
end

Copy link
Owner

Choose a reason for hiding this comment

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

I don't think there's need for these version gymnastics. I propose we use Logger.levels/0, but we should then change mix.exs and require 1.16+. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👋 @sasa1977

Of course I prefer this :)

I just didn't think it was appropriate to ask for dropping support for old Elixir versions just to support my little feature request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update the PR in the next few minutes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@certification_schema [
client: [
type: {:in, [:native, :certbot]},
Expand Down Expand Up @@ -114,7 +121,7 @@ defmodule SiteEncrypt do
"""
],
log_level: [
type: {:in, Logger.levels()},
type: {:in, log_levels},
default: :info,
doc: "Logger level for info messages."
],
Expand Down