Unclear instructions for Elixir Log Level exercise

Hello all, I just started going through the Elixir track the other day and I’m confused by the directions given for the “Log Level” exercise.
For the first part the instruction says:

Implement the LogLevel.to_label/2 function. It should take an integer code and a boolean flag telling you if the log comes from a legacy app, and return the label of a log line as an atom. Unknown log codes and codes unsupported in a legacy app should return an unknown label.

In the example outputs are like this:

LogLevel.to_label(0, false)

=> :trace

LogLevel.to_label(0, true)

=> :unknown

This confuses me because for both examples the log code is a 0, which is a known log code, but the first example passes false for the second argument and apparently the expected return value is :trace . But the instructions clearly say that Unknown log codes and codes unsupported in a legacy app should return an unknown label. So which is it that is wanted? The code 0, while a known code, is NOT supported in legacy apps, so shouldn’t that return :unknown according to the instructions??
I’m very confused here…

1 Like

Did you see the table of known log codes and which ones are supported in a legacy app? It’s right there before the description of the first task.

Hi, thanks for the reply. Yes, I did see the table and I actually did finish the exercise, but I still felt (and still do feel) the instructions were unclear.

I would happily offer to to rewrite the instructions to be clearer, but from what I understand, Exercism has paused community contributions (And with completely reasonable and acceptable reasons). Do you happen to know if anything has changed regarding that?

Elixir is still accepting community contributions. But if you saw the table, then I actually don’t understand what is unclear about the current instructions.

So which is it that is wanted? The code 0, while a known code, is NOT supported in legacy apps, so shouldn’t that return :unknown according to the instructions??

The code 0 is known in modern apps, but unknown in legacy apps. The second argument of the to_label function tells you if the code came from a legacy app. Hence 0’s label differs based on that argument.

If you propose a concrete diff here, it’ll gladly be discussed. If the response is good, a PR is welcome.

```diff
  diff syntax
- diff syntax
+ diff syntax
```
  diff syntax
- diff syntax
+ diff syntax

Thank you both! I’ll definitely consider posting a new thread with a diff… :blush: