Skip to content
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

Allow setting logger's format at runtime #436

Merged
merged 3 commits into from
Mar 25, 2021

Conversation

blisscs
Copy link
Contributor

@blisscs blisscs commented Nov 27, 2020

Hi,

Currently, I am having an issue that I can't set the format of the logger at runtime because the current implementation takes the format string from the module attribute which is set at compile time. With this pull request, we will be able to set the format at run time with the below code sample.

  middleware = [
    {Tesla.Middleware.Logger, format: "$method $url -> $status ($time ms)"}
    # ,... more middlewares
  ]

  client = Tesla.client(middleware)

@blisscs blisscs changed the title Allow setting format at runtime Allow setting logger's format at runtime Nov 27, 2020
@blisscs
Copy link
Contributor Author

blisscs commented Dec 12, 2020

Hi @teamon,

I have been using tesla for some time now. I have a little issues in that i can't configure my logger's format at runtime. This merge request will help to resolve that. please help review this merge request, if you have any comments please let's me know

Thanks.
Suracheth

@blisscs
Copy link
Contributor Author

blisscs commented Feb 3, 2021

Hi @teamon Please let's me know what do you think of this merge request to allow setting the format of logger at runtime.

@blisscs
Copy link
Contributor Author

blisscs commented Feb 8, 2021

@thiamsantos I update the code to use pipe. Let's me know if you need other changes.

@teamon
Copy link
Member

teamon commented Mar 25, 2021

Perfect!

@teamon teamon merged commit 7d86a62 into elixir-tesla:master Mar 25, 2021
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