Skip to content

Commit

Permalink
chore: log insert new line on end of log str
Browse files Browse the repository at this point in the history
  • Loading branch information
erzhae committed Oct 25, 2024
1 parent fd51ce2 commit 1abd649
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ func (c Client) Publish(ctx context.Context, topicId string, msg Message) (strin

messageId, err := result.Get(ctx)
if err != nil {
fmt.Printf("[pubsub][onMessagePublishErr] err: %s", err.Error())
fmt.Printf("[pubsub][onMessagePublishErr] err: %s\n", err.Error())
return "", err
}

fmt.Printf("[pubsub][onMessagePublished] id: %s", messageId)
fmt.Printf("[pubsub][onMessagePublished] id: %s\n", messageId)
return messageId, nil
}

Expand Down Expand Up @@ -170,17 +170,17 @@ func (c Client) Subscribe(ctx context.Context, subscriptionId string, conf Subsc
Publish: msg.PublishTime,
DeliveryAttempt: msg.DeliveryAttempt,
}
fmt.Printf("[pubsub][onMessageReceived] id: %s", message.Id)
fmt.Printf("[pubsub][onMessageReceived] id: %s\n", message.Id)

err := handler(ctx, message)
if err != nil {
msg.Nack()
fmt.Printf("[pubsub][onMessageNacked] id: %s", message.Id)
fmt.Printf("[pubsub][onMessageNacked] id: %s\n", message.Id)
return
}

msg.Ack()
fmt.Printf("[pubsub][onMessageAcked] id: %s", message.Id)
fmt.Printf("[pubsub][onMessageAcked] id: %s\n", message.Id)
})
}

Expand Down

0 comments on commit 1abd649

Please sign in to comment.