Skip to content

Commit

Permalink
docs: Document the Kratos logging adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
nhhagen committed Sep 16, 2024
1 parent 295e6d6 commit af79082
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions adapter/kratos/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type LoggerKratosAdapter struct {
//
// import (
// "github.com/coopnorge/go-logger"
// "github.com/coopnorge/go-logger/adapter/kratos"
// "github.com/go-kratos/kratos/v2/log"
// )
//
Expand Down
19 changes: 19 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,25 @@ func main() {
}
```

### Kratos

To ensure that Kratos outputs logs in the correct format Kratos must be
configured with a custom logger.

```go
package main

import (
"github.com/coopnorge/go-logger"
"github.com/coopnorge/go-logger/adapter/kratos"
"github.com/go-kratos/kratos/v2/log"
)

func main() {
log.SetLogger(logs.NewLoggerKratosAdapter(logger.Global()))
}
```

## Hooks

Hooks are functions that are triggered on all log-entries and allow for data to
Expand Down

0 comments on commit af79082

Please sign in to comment.