1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Send Request and Publication types

This commit is contained in:
Asim
2015-12-02 20:56:50 +00:00
parent 4b18b779aa
commit a695e10d21
7 changed files with 103 additions and 21 deletions

View File

@ -10,8 +10,8 @@ import (
)
func logWrapper(fn server.HandlerFunc) server.HandlerFunc {
return func(ctx context.Context, req interface{}, rsp interface{}) error {
log.Infof("[Log Wrapper] Before serving request")
return func(ctx context.Context, req server.Request, rsp interface{}) error {
log.Infof("[Log Wrapper] Before serving request method: %v", req.Method())
err := fn(ctx, req, rsp)
log.Infof("[Log Wrapper] After serving request")
return err
@ -19,8 +19,8 @@ func logWrapper(fn server.HandlerFunc) server.HandlerFunc {
}
func logSubWrapper(fn server.SubscriberFunc) server.SubscriberFunc {
return func(ctx context.Context, req interface{}) error {
log.Infof("[Log Sub Wrapper] Before serving publication")
return func(ctx context.Context, req server.Publication) error {
log.Infof("[Log Sub Wrapper] Before serving publication topic: %v", req.Topic())
err := fn(ctx, req)
log.Infof("[Log Sub Wrapper] After serving publication")
return err