Skip to content

Commit b4d5bb5

Browse files
authored
Merge pull request #931 from neo773/json-log
docs: add log ouput, refactor: default log output
2 parents 5bf831e + b4438dc commit b4d5bb5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/docs/reference/configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,14 @@ Real time logs of authorization. Permify uses [zerolog] as a logger.
185185
| Required | Argument | Default | Description |
186186
|----------|----------|---------|--------------------------------------------------|
187187
| [x] | level | info | logger levels: `error`, `warn`, `info` , `debug` |
188+
| [x] | output | text | logger output: `json`, `text` |
188189

189190
#### ENV
190191

191192
| Argument | ENV | Type |
192193
|---------------------------|---------------------------------|--------|
193194
| log-level | PERMIFY_LOG_LEVEL | string |
195+
| log-output | PERMIFY_LOG_OUTPUT | string |
194196

195197
</p>
196198
</details>

pkg/cmd/serve.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ func serve() func(cmd *cobra.Command, args []string) error {
100100
Level: getLogLevel(cfg.Log.Level),
101101
})
102102
default:
103-
return fmt.Errorf("invalid log output: %s", cfg.Log.Output)
103+
handler = slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
104+
Level: getLogLevel(cfg.Log.Level),
105+
})
104106
}
105107

106108
logger := slog.New(handler)

0 commit comments

Comments
 (0)