Skip to content

Commit 6f29ef6

Browse files
committed
revert txt handler behavior
1 parent e204deb commit 6f29ef6

4 files changed

Lines changed: 10 additions & 8 deletions

File tree

lh/text.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (h *TextHandler) handleRegularOutput(e *lx.Entry) error {
147147
}
148148

149149
// Add level and message
150-
builder.WriteString(rightPad(e.Level.String(), 5))
150+
builder.WriteString(e.Level.String())
151151
builder.WriteString(lx.Colon)
152152
builder.WriteString(lx.Space)
153153
builder.WriteString(e.Message)

tests/handler_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package tests
33
import (
44
"bytes"
55
"encoding/json"
6-
"github.com/olekukonko/ll"
7-
"github.com/olekukonko/ll/lh"
8-
"github.com/olekukonko/ll/lx"
96
"log/slog"
107
"strings"
118
"testing"
9+
10+
"github.com/olekukonko/ll"
11+
"github.com/olekukonko/ll/lh"
12+
"github.com/olekukonko/ll/lx"
1213
)
1314

1415
// TestHandlers verifies the behavior of all log handlers (Text, Colorized, JSON, Slog, Multi).
@@ -90,7 +91,7 @@ func TestHandlers(t *testing.T) {
9091
logger.Fields("key", "value").Infof("Test multi")
9192
// Verify TextHandler output
9293
if !strings.Contains(buf1.String(), "[test] INFO: Test multi [key=value]") {
93-
t.Errorf("Expected %q to contain %q", buf1.String(), "[test] INFO: Test multi [key=value]")
94+
t.Errorf("Expected %q to contain %q", buf1.String(), "[test] INFO : Test multi [key=value]")
9495
}
9596
// Verify JSONHandler output
9697
var data map[string]interface{}

tests/ll_ns_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package tests
33

44
import (
55
"bytes"
6+
"strings"
7+
"testing"
8+
69
"github.com/olekukonko/ll"
710
"github.com/olekukonko/ll/lh"
811
"github.com/olekukonko/ll/lx"
9-
"strings"
10-
"testing"
1112
)
1213

1314
// TestNamespaceEnableWithCustomSeparator verifies that enabling a namespace with a custom separator

tests/ll_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ func TestTextHandler(t *testing.T) {
533533
t.Errorf("Handle failed: %v", err)
534534
}
535535
// Verify the output format
536-
if !strings.Contains(buf.String(), "INFO : test [key=1]") {
536+
if !strings.Contains(buf.String(), "INFO: test [key=1]") {
537537
t.Errorf("Unexpected output: %s", buf.String())
538538
}
539539
}

0 commit comments

Comments
 (0)