anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
2 stars 9 forks source link

Logger API `Error(...)` method #15

Closed jamesrom closed 4 years ago

jamesrom commented 4 years ago

A convenience function to help with error handling could be useful.

if err != nil {
    log.From(ctx).Error("Couldn't foo", err)
    return err
}

Should produce something like

msg="Couldn't foo" error_message="connection timed out"
anzdaddy commented 4 years ago

Seems pretty useful. Let's add it. Semantically, I think it should be just a variant of Info, not a different "level".