aboutsummaryrefslogtreecommitdiff
path: root/setup/jetstream/log.go
blob: 880f7120bb9fbc9b09272465437f78421b775390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package jetstream

import (
	"github.com/nats-io/nats-server/v2/server"
	"github.com/sirupsen/logrus"
)

var _ server.Logger = &LogAdapter{}

type LogAdapter struct {
	entry *logrus.Entry
}

func NewLogAdapter() *LogAdapter {
	return &LogAdapter{
		entry: logrus.StandardLogger().WithField("component", "jetstream"),
	}
}

func (l *LogAdapter) Noticef(format string, v ...interface{}) {
	l.entry.Infof(format, v...)
}

func (l *LogAdapter) Warnf(format string, v ...interface{}) {
	l.entry.Warnf(format, v...)
}

func (l *LogAdapter) Fatalf(format string, v ...interface{}) {
	l.entry.Fatalf(format, v...)
}

func (l *LogAdapter) Errorf(format string, v ...interface{}) {
	l.entry.Errorf(format, v...)
}

func (l *LogAdapter) Debugf(format string, v ...interface{}) {
	l.entry.Debugf(format, v...)
}

func (l *LogAdapter) Tracef(format string, v ...interface{}) {
	l.entry.Tracef(format, v...)
}