Hi,
I'm new-ish to go-kit (and to Go for that matter) and actually not even a proper developer, but I've been learning Go and started reading through the stringsvc example here:
https://gokit.io/examples/stringsvc.html ...
I'm a bit confused by this here:
func loggingMiddleware(logger log.Logger) Middleware {
return func(next endpoint.Endpoint) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
logger.Log("msg", "calling endpoint")
defer logger.Log("msg", "called endpoint")
return next(ctx, request)
}
}
}
and then the use of
count = loggingMiddleware(log.With(logger, "method", "count"))(count)
I do understand the calling of loggingMiddleware (as such) but what confused me is what the additional
at the end of the function call is doing ?
It's probably much more a generic-ish Go / programming question than specific to go-kit, but it's used here and I'd like to understand it :)
Thanks!
Alex