MCPcopy
hub / github.com/etcd-io/etcd / TestNewJournalWriter

Function TestNewJournalWriter

client/pkg/logutil/zap_journal_test.go:27–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestNewJournalWriter(t *testing.T) {
28 buf := bytes.NewBuffer(nil)
29 jw, err := NewJournalWriter(buf)
30 if err != nil {
31 t.Skip(err)
32 }
33
34 syncer := zapcore.AddSync(jw)
35
36 cr := zapcore.NewCore(
37 zapcore.NewJSONEncoder(DefaultZapLoggerConfig.EncoderConfig),
38 syncer,
39 zap.NewAtomicLevelAt(zap.InfoLevel),
40 )
41
42 lg := zap.New(cr, zap.AddCaller(), zap.ErrorOutput(syncer))
43 defer lg.Sync()
44
45 lg.Info("TestNewJournalWriter")
46 if buf.String() == "" {
47 // check with "journalctl -f"
48 t.Log("sent logs successfully to journald")
49 }
50}

Callers

nothing calls this directly

Calls 6

NewJournalWriterFunction · 0.85
InfoMethod · 0.80
SkipMethod · 0.65
SyncMethod · 0.65
StringMethod · 0.65
LogMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…