title: Go Gin framework to log in JSON
body: <p>I am setting up a small API using Go Gin, however I am unable to convince the logger to output JSON. By default it's a key/value string, but I need it as json.</p>
  
  <p>How can I achieve that? I feel it should be easily support but I've been struggling with a custom formatting function where I need to account for various parameters myself.</p>
  
  <p>Alternatively, I also log manually using uber/zap logger but I haven't found a way to replace gin's logger with mine.</p>
  
  <p>Any pointers would be appreciated as the documentation on gin's github wasn't too helpful.</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: to clarify, adding a middlware helps with logging requests, but I'm looking for single point of setting JSON logging for Gin (eg: including logs not related to requests, such as debug / info logs of framework internals)</p>