Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Baron authored Sep 2, 2020
2 parents ac297db + 60007d8 commit b2af995
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
11 changes: 1 addition & 10 deletions docs/LOGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,8 @@ func SomeHandler(invocation gbus.Invocation, message *gbus.BusMessage) error{
}
```
grabbit makes it easier handling these cases and reduce the repetitive task of logging
<<<<<<< HEAD
<<<<<<< HEAD
these custom contextual attributes in cases of errors by integrating the [emperror errors package](https://github.com/emperror/errors).
=======
these custom contextual attributes in cases of errors by integrating the [emperror errors package] (https://github.com/emperror/errors).
>>>>>>> Fix logging and added logging documentation (#176)
=======
these custom contextual attributes in cases of errors by integrating the [emperror errors package](https://github.com/emperror/errors).
>>>>>>> added documentation on serialization support (#177)

emperror drop-in replacement for the default errors package allows developers to add the needed contextual data on the error instance and have graabit log the error with all contextual attribute.

```go
Expand Down Expand Up @@ -90,8 +83,6 @@ func placeOrder(customerID string, lineItems LineItems[]) error{

```



### Setting a custom logger instance

grabbit will create a default instance of logrus FieldLogger if no such logger is set when the bus is created.
Expand Down
2 changes: 1 addition & 1 deletion examples/vacation_app/cmd/flights.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"vacation_app/messages"
"vacation_app/trace"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/wework/grabbit/gbus"
Expand Down
8 changes: 4 additions & 4 deletions examples/vacation_app/saga/booking_saga.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (bs *BookingSaga) HandleBookFlightsRsp(invocation gbus.Invocation, message
if bs.CancelingFlights == false {
bs.FinishedWithFlights = true
}
return bs.notifyInitiatorIfSagaComplets(true, invocation.Ctx(), invocation)
return bs.notifyInitiatorIfSagaCompletes(true, invocation.Ctx(), invocation)
}

func (bs *BookingSaga) HandleBookHotelRsp(invocation gbus.Invocation, message *gbus.BusMessage) error {
Expand All @@ -82,7 +82,7 @@ func (bs *BookingSaga) HandleBookHotelRsp(invocation gbus.Invocation, message *g
return invocation.Bus().Send(invocation.Ctx(), "flights-service", cancelFlightsCmd)
}

return bs.notifyInitiatorIfSagaComplets(true, invocation.Ctx(), invocation)
return bs.notifyInitiatorIfSagaCompletes(true, invocation.Ctx(), invocation)

}

Expand All @@ -91,10 +91,10 @@ func (bs *BookingSaga) HandleCancelFlightsRsp(invocation gbus.Invocation, messag
invocation.Log().Infof("flights were canceled ? %t", response.Success)
bs.FinishedWithFlights = true

return bs.notifyInitiatorIfSagaComplets(false, invocation.Ctx(), invocation)
return bs.notifyInitiatorIfSagaCompletes(false, invocation.Ctx(), invocation)
}

func (bs *BookingSaga) notifyInitiatorIfSagaComplets(success bool, ctx context.Context, invocation gbus.Invocation) error {
func (bs *BookingSaga) notifyInitiatorIfSagaCompletes(success bool, ctx context.Context, invocation gbus.Invocation) error {

if bs.IsComplete() {

Expand Down

0 comments on commit b2af995

Please sign in to comment.