Closed darbyfrey closed 9 years ago
Looks like a great set of logging features to have in the Napa platform. Thanks.
:fire: :fire: :fire:
Awesome additions here. Looking forward to the discussion of @hstrowd's points.
@hstrowd @umtrey just pushed up some changes related to your comments. Let me know if you have any other thoughts.
sad travis, but my thoughts? you're pretty swell.
That's what happens when I get a little to crazy with the Rubocop... fixed!
+:boom:
+1 from me.
@darbyfrey: could you update the README and CHANGELOG?
This is a pretty big refactor of the Napa logger, but it adds some nice features that have been requested for some time. Namely, Heroku support and more readable output in development. Details below:
Heroku support
The problem in the past with running Napa on Heroku is that Napa expected to be able to write it's log files to the
log/
directory on the file system. Heroku doesn't let you do that, so the fix has been to monkey patch Napa to disable the log file appender. With this change, Napa will detect if it is running on Heroku and disable the log file appender automatically. Magic!Better dev output
In the previous logger, all output was in JSON format. This is good for production so that it can be easily parsed by things like Kibana, but it's messy in development because it's hard for humans to read. This change will use a different output format in development so that logs are easier to read. It changes the output from this:
To this:
This is also a YAML formatter that can be used and will look like this:
To enable YAML output, you can add an initializer in your app with the following:
config/initializers/logger.rb
Defaults
By default, the logger will behave exactly the same as it does now in production. It will still log everything as JSON with the same structure, and it will still write the file to
log/
.Resolves: https://github.com/bellycard/napa/issues/196
Feedback appreciated!
@bellycard/platform @craigulliott