Permalink
Browse files

Add custom logger example

This adds a custom logger example demonstrating the use of a custom logger.
  • Loading branch information...
binarylogic committed Aug 22, 2017
1 parent 01e7f33 commit ceab2e331eecdb266adf68a11914bc4e9bd112e7
Showing with 24 additions and 0 deletions.
  1. +24 −0 source/guides/head/projects/logging.md
@@ -70,6 +70,30 @@ Hanami.configure do
end
```
## Custom Loggers
You can specify a custom logger in cases where you desire different logging behaviour. For example,
the [Timber logger](https://github.com/timberio/timber-ruby):
```ruby
# config/environment.rb
# ...
Hanami.configure do
# ...
environment :production do
logger Timber::Logger.new(STDOUT)
# ...
end
end
```
Use this logger as normal via `Hanami.logger`. It's important to note that any logger chosen
must conform to the default `::Logger` interface.
## Automatic Logging
All HTTP requests, SQL queries, and database operations are automatically logged.

0 comments on commit ceab2e3

Please sign in to comment.