aserafin / grape_logging

Request logging for Grape!
MIT License
147 stars 76 forks source link

Add GrapeLogging::Formatters::Rails. Updates to README #47

Closed daveharris closed 6 years ago

daveharris commented 6 years ago

@aserafin I added this Formatter to get a line like the last line in a standard Rails app:

Rails:

Completed 200 OK in 958ms (Views: 951.1ms | ActiveRecord: 3.8ms)

After this change with formatter: GrapeLogging::Formatters::Rails.new:

Completed 200 OK in 191ms (Views: 159.37ms | DB: 31.23ms)

I haven't found a way to determine the installed ORM so I had to change ActiveRecord to DB.

I also cleaned up the README giving examples of each formatter and added some specs for my new formatter.

I have tested it in a real-life Rails+Grape app and works great.

I haven't submitted a PR before so let me know if there is anything else I need to do.

Thanks for the gem!

aserafin commented 6 years ago

@daveharris great addition and thanks for the output documentation for other formatters 💪