Skip to content

fix(spec): add :all and :none for Logger.level/0 #13513

New issue

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

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

Already on GitHub? Sign in to your account

Conversation

davidjulien
Copy link
Contributor

👋

I think that the spec for Logger.level/0 is invalid: :all and :none may be missing.

According to https://www.erlang.org/doc/man/logger#get_primary_config-0 and https://www.erlang.org/doc/man/logger#type-primary_config,
returned type for :logger.get_primary_config is:

 #{level => level() | all | none,
   metadata => metadata(),
   filter_default => log | stop,
   filters => [{filter_id(), filter()}]}

Thus, inside Logger.level/0 fun, level could also be all and none when calling:

%{level: level} = :logger.get_primary_config()

According to https://www.erlang.org/doc/man/logger#get_primary_config-0 and https://www.erlang.org/doc/man/logger#type-primary_config,
returned type for `:logger.get_primary_config` is:

```erlang
 #{level => level() | all | none,
   metadata => metadata(),
   filter_default => log | stop,
   filters => [{filter_id(), filter()}]}
```

Thus, inside `Logger.level/0` fun, `level` could also be `all` and `none` when calling:

```elixir
%{level: level} = :logger.get_primary_config()
```
@whatyouhide whatyouhide merged commit c5816a2 into elixir-lang:main Apr 26, 2024
8 of 9 checks passed
@whatyouhide
Copy link
Member

Thanks @davidjulien 💟

@davidjulien davidjulien deleted the fix/add-all-and-none-in-spec-of-logger-level-0 branch April 26, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants