elixir-tesla / tesla

The flexible HTTP client library for Elixir, with support for middleware and multiple adapters.
MIT License
2.01k stars 345 forks source link

Documentation Issues: Logger Middleware #379

Open aselder opened 4 years ago

aselder commented 4 years ago

I was running it to a situation where I set the log_level of a Logger middleware to always be :debug, but I was still seeing log output with the Logger log_level set to warn.

Looking at the code, it does something slightly different than was the documentation says.

If the request returns {:error, whatever}, the log level is always set to :error, the custom log level function is never called. The custom log level is only used when an {:ok, ...} is returned.

aselder commented 4 years ago

Also, the docs don't mention that you can pass an atom instead of a function as the log_level option

aselder commented 4 years ago

I'll see what I can do about putting together a PR.

teamon commented 3 years ago

Hey @aselder, do you still want to give this a try? :)