log icon indicating copy to clipboard operation
log copied to clipboard

When to call function close in graylog handler?

Open halink0803 opened this issue 6 years ago • 1 comments

Hi, I am really interested in apex/log because of its built in handler to support many different logger and services. However, I don't see an example for using graylog handler. I tried to implement it myself and it works (perfectly). However, I wonder there is a Close function in the handler and I don't know when to call it?

https://github.com/apex/log/blob/941dea75d3ebfbdd905a5d8b7b232965c5e5c684/handlers/graylog/graylog.go#L59

Can you provide a full example of using graylog handler and specify using of Close function.

Best regards,

halink0803 avatar Jul 26 '18 07:07 halink0803

Good question, that one was contributed, but it looks like you can just Close() when your application is shutting down to flush the remaining logs:

https://github.com/aphistic/golf/blob/master/client.go#L119

tj avatar Jul 26 '18 20:07 tj