MCPcopy Create free account
hub / github.com/coder/slog / TestEntry

Function TestEntry

internal/entryhuman/entry_test.go:31–287  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestEntry(t *testing.T) {
32 t.Parallel()
33
34 type tcase struct {
35 name string
36 ent slog.SinkEntry
37 }
38
39 ents := []tcase{
40 {
41 "simpleNoFields",
42 slog.SinkEntry{
43 Message: "wowowow\tizi",
44 Time: kt,
45 Level: slog.LevelDebug,
46
47 File: "myfile",
48 Line: 100,
49 Func: "mypkg.ignored",
50 },
51 },
52 {
53 "multilineMessage",
54 slog.SinkEntry{
55 Message: "line1\nline2",
56 Level: slog.LevelInfo,
57 },
58 },
59 {
60 "multilineField",
61 slog.SinkEntry{
62 Message: "msg",
63 Level: slog.LevelInfo,
64 Fields: slog.M(slog.F("field", "line1\nline2")),
65 },
66 },
67 {
68 "named",
69 slog.SinkEntry{
70 Level: slog.LevelWarn,
71 LoggerNames: []string{"some", "cat"},
72 Message: "meow",
73 Fields: slog.M(
74 slog.F("breath", "stinky"),
75 ),
76 },
77 },
78 {
79 "funky",
80 slog.SinkEntry{
81 Level: slog.LevelWarn,
82 Fields: slog.M(
83 slog.F("funky^%&^&^key", "value"),
84 slog.F("funky^%&^&^key2", "@#\t \t \n"),
85 ),
86 },
87 },
88 {

Callers

nothing calls this directly

Calls 4

FmtFunction · 0.92
EqualFunction · 0.92
StringMethod · 0.80
FatalMethod · 0.45

Tested by

no test coverage detected