Fix mappings in logrus jetstream adapter

Clarify SetLogger call in jetstream

Signed-off-by: David Schneider <dsbrng25b@gmail.com>
This commit is contained in:
David Schneider 2023-02-23 16:49:37 +01:00
parent 87a2068e1a
commit 5d2f03f01b
2 changed files with 6 additions and 5 deletions

View file

@ -22,11 +22,11 @@ func (l *LogAdapter) Noticef(format string, v ...interface{}) {
} }
func (l *LogAdapter) Warnf(format string, v ...interface{}) { func (l *LogAdapter) Warnf(format string, v ...interface{}) {
l.entry.Errorf(format, v...) l.entry.Warnf(format, v...)
} }
func (l *LogAdapter) Fatalf(format string, v ...interface{}) { func (l *LogAdapter) Fatalf(format string, v ...interface{}) {
l.entry.Errorf(format, v...) l.entry.Fatalf(format, v...)
} }
func (l *LogAdapter) Errorf(format string, v ...interface{}) { func (l *LogAdapter) Errorf(format string, v ...interface{}) {

View file

@ -40,7 +40,7 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
} }
if s.Server == nil { if s.Server == nil {
var err error var err error
s.Server, err = natsserver.NewServer(&natsserver.Options{ opts := &natsserver.Options{
ServerName: "monolith", ServerName: "monolith",
DontListen: true, DontListen: true,
JetStream: true, JetStream: true,
@ -49,11 +49,12 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
MaxPayload: 16 * 1024 * 1024, MaxPayload: 16 * 1024 * 1024,
NoSigs: true, NoSigs: true,
NoLog: cfg.NoLog, NoLog: cfg.NoLog,
}) }
s.Server, err = natsserver.NewServer(opts)
if err != nil { if err != nil {
panic(err) panic(err)
} }
s.SetLogger(NewLogAdapter(), false, false) s.SetLogger(NewLogAdapter(), opts.Debug, opts.Trace)
go func() { go func() {
process.ComponentStarted() process.ComponentStarted()
s.Start() s.Start()