mirror of
https://github.com/samsonjs/grape_logging.git
synced 2026-04-27 14:57:40 +00:00
change readme to reflect setting formatter being optional
This commit is contained in:
parent
09f9dbc8e9
commit
dc18ddb1d3
1 changed files with 2 additions and 8 deletions
10
README.md
10
README.md
|
|
@ -24,6 +24,8 @@ In your api file (somewhere on the top)
|
||||||
logger.formatter = GrapeLogging::Formatters::Default.new
|
logger.formatter = GrapeLogging::Formatters::Default.new
|
||||||
use GrapeLogging::Middleware::RequestLogger, { logger: logger }
|
use GrapeLogging::Middleware::RequestLogger, { logger: logger }
|
||||||
|
|
||||||
|
**ProTip:** If your logger doesn't support setting formatter you can remove this line - it's optional
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Log Format
|
### Log Format
|
||||||
|
|
@ -84,14 +86,6 @@ and then add an initializer in your Rails project:
|
||||||
|
|
||||||
The idea come from here: https://gist.github.com/teamon/e8ae16ffb0cb447e5b49
|
The idea come from here: https://gist.github.com/teamon/e8ae16ffb0cb447e5b49
|
||||||
|
|
||||||
There's some advantages to use this method:
|
|
||||||
|
|
||||||
- You could use a logger that does not implement the ```formatter=```.
|
|
||||||
Defaults Rails 3 (ActiveSupport::BufferedLogger) does not implement it.
|
|
||||||
The Logging gem (https://github.com/TwP/logging) does not implement it neither.
|
|
||||||
|
|
||||||
- If you use a logger that already format logs (as the Logging gem), the logs will be formatted by your logger.
|
|
||||||
|
|
||||||
### Logging exceptions
|
### Logging exceptions
|
||||||
|
|
||||||
If you want to log exceptions you can do it like this
|
If you want to log exceptions you can do it like this
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue