Skip to content

Conversation

@arikkfir
Copy link

This change adds support for fixed-length source code field rendering, with smart-trimming that keeps the start & end section, with ... replacing the part that gets removed.

Configuration:

handler = console.NewHandler(os.Stdout, &console.HandlerOptions{
	SourceLength: 20,
})

Examples (max-length 20):

Source: 1234567890                      -> 10:00PM INF 1234567890           > Some log line
Source: pkgA/pkgB/jack_the_knife.go:123 -> 10:00PM INF pkgA/pkg...fe.go:123 > Another log line
Source: testing/superlogs.go:12         -> 10:00PM INF testing/...ogs.go:12 > Yet another log line

This change adds support for fixed-length source code field rendering, with smart-trimming that keeps the start & end section, with `...` replacing the part that gets removed.

Configuration:
```go
handler = console.NewHandler(os.Stdout, &console.HandlerOptions{
	SourceLength: 20,
})
```

Examples (max-length 20):
```
Source: 1234567890                      -> 10:00PM INF 1234567890           > Some log line
Source: pkgA/pkgB/jack_the_knife.go:123 -> 10:00PM INF pkgA/pkg...fe.go:123 > Another log line
Source: testing/superlogs.go:12         -> 10:00PM INF testing/...ogs.go:12 > Yet another log line
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant