Skip to content

Commit

Permalink
Update docs to show renamed method for custom formatters.
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Dec 13, 2022
1 parent da910bf commit 51b8fcf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/middleware/response/logger.md
Expand Up @@ -96,7 +96,8 @@ end
You can also provide a custom formatter to control how requests, responses and errors are logged.
Any custom formatter MUST implement the `request` and `response` method, with one argument which
will be passed being the Faraday environment.
Any custom formatter CAN implement the `error` method, with one argument which will be passed being the Faraday error.
Any custom formatter CAN implement the `exception` method,
with one argument which will be passed being the exception (StandardError).
If you make your formatter inheriting from `Faraday::Logging::Formatter`,
then the methods `debug`, `info`, `warn`, `error` and `fatal` are automatically delegated to the logger.

Expand All @@ -112,8 +113,8 @@ class MyFormatter < Faraday::Logging::Formatter
info('Response') { 'Response Received' }
end

def error(error)
# Build a custom message using `error`
def exception(exc)
# Build a custom message using `exc`
info('Error') { 'Error Raised' }
end
end
Expand Down

0 comments on commit 51b8fcf

Please sign in to comment.