feat: update slog to use logfmt (#7477)

This commit is contained in:
Ammar Bandukwala
2023-05-14 20:23:13 +00:00
committed by GitHub
parent 0f4717e471
commit f05f12231d
19 changed files with 92 additions and 54 deletions
+12 -2
View File
@@ -6,18 +6,28 @@ import (
"strings"
"testing"
"github.com/charmbracelet/lipgloss"
"github.com/muesli/termenv"
"github.com/stretchr/testify/require"
"github.com/coder/coder/cli/clitest"
"github.com/coder/coder/testutil"
)
// We need to override the global color profile to test escape codes.
//
//nolint:tparallel,paralleltest
func TestVersion(t *testing.T) {
t.Parallel()
ogColorProfile := lipgloss.ColorProfile()
lipgloss.SetColorProfile(termenv.ANSI)
t.Cleanup(func() {
lipgloss.SetColorProfile(ogColorProfile)
})
expectedText := `Coder v0.0.0-devel
https://github.com/coder/coder
Full build of Coder, supports the server subcommand.
Full build of Coder, supports the  server  subcommand.
`
expectedJSON := `{
"version": "v0.0.0-devel",