Skip to content

Commit b2af995

Browse files
author
Guy Baron
authored
Merge branch 'master' into master
2 parents ac297db + 60007d8 commit b2af995

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

docs/LOGGING.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,8 @@ func SomeHandler(invocation gbus.Invocation, message *gbus.BusMessage) error{
5454
}
5555
```
5656
grabbit makes it easier handling these cases and reduce the repetitive task of logging
57-
<<<<<<< HEAD
58-
<<<<<<< HEAD
5957
these custom contextual attributes in cases of errors by integrating the [emperror errors package](https://github.com/emperror/errors).
60-
=======
61-
these custom contextual attributes in cases of errors by integrating the [emperror errors package] (https://github.com/emperror/errors).
62-
>>>>>>> Fix logging and added logging documentation (#176)
63-
=======
64-
these custom contextual attributes in cases of errors by integrating the [emperror errors package](https://github.com/emperror/errors).
65-
>>>>>>> added documentation on serialization support (#177)
58+
6659
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.
6760

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

9184
```
9285

93-
94-
9586
### Setting a custom logger instance
9687

9788
grabbit will create a default instance of logrus FieldLogger if no such logger is set when the bus is created.

examples/vacation_app/cmd/flights.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"vacation_app/messages"
88
"vacation_app/trace"
9-
9+
1010
log "github.com/sirupsen/logrus"
1111
"github.com/spf13/cobra"
1212
"github.com/wework/grabbit/gbus"

examples/vacation_app/saga/booking_saga.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (bs *BookingSaga) HandleBookFlightsRsp(invocation gbus.Invocation, message
6161
if bs.CancelingFlights == false {
6262
bs.FinishedWithFlights = true
6363
}
64-
return bs.notifyInitiatorIfSagaComplets(true, invocation.Ctx(), invocation)
64+
return bs.notifyInitiatorIfSagaCompletes(true, invocation.Ctx(), invocation)
6565
}
6666

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

85-
return bs.notifyInitiatorIfSagaComplets(true, invocation.Ctx(), invocation)
85+
return bs.notifyInitiatorIfSagaCompletes(true, invocation.Ctx(), invocation)
8686

8787
}
8888

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

94-
return bs.notifyInitiatorIfSagaComplets(false, invocation.Ctx(), invocation)
94+
return bs.notifyInitiatorIfSagaCompletes(false, invocation.Ctx(), invocation)
9595
}
9696

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

9999
if bs.IsComplete() {
100100

0 commit comments

Comments
 (0)