Do you need to log every request? Do you need to know the contents of the
request? Metrics are far cheaper to maintain than a log line. Also,
consider sampling, or only logging slow requests (though put a limit on
them over a period: when your system goes wrong you don't want all the slow
logging requests be the bottleneck in the system).

On Mon, Jul 17, 2017 at 7:03 PM <desaiabhi...@gmail.com> wrote:

> Hi Nate
>
> Thanks very much for the info
>
> Rgds,
>
> Abhi
>
>
>
> On Monday, July 17, 2017 at 10:19:58 PM UTC+5:30, Nate Finch wrote:
>>
>> Basically any log package will be pretty quick.   None of them will be
>> zero overhead, that's impossible, but most will not affect the time of your
>> requests terribly significantly.
>>
>> I personally like logrus (https://github.com/sirupsen/logrus) for
>> structured logging, it has a lot of adapters available to pipe the log
>> wherever you need it to go.  There's also a middlewear for gin called
>> ginrus that'll log to logrus.
>>
>> If you want the fastest possible logging, glog (
>> https://github.com/golang/glog) is very optimized but is just plaintext,
>> not structured, and doesn't have all the adapters of logrus.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to