I need to customize log messages to a JSON format in my Rails app.
To illustrate, currently the log messages my app produces look like this:
I, [2015-04-24T11:52:06.612993 #90159] INFO -- : Started GET "/time_entries" for ::1 at 2015-04-24 11:52:06 -0400
As a result, log messages like the line above get written to my log.
I need to change this format to JSON. How can I make the log output formatted exactly like the following example?
{
"type" : "info",
"time" : "2015-04-24T11:52:06.612993",
"message" : "Started GET "/time_entries" for ::1 at 2015-04-24 11:52:06 -0400"
}
Note: It doesn't need to be pretty printed like my example, it just has to have the JSON format.