github.com/drone/runner-go@v1.12.0/logger/logrus.go (about)

     1  // Copyright 2019 Drone.IO Inc. All rights reserved.
     2  // Use of this source code is governed by the Polyform License
     3  // that can be found in the LICENSE file.
     4  
     5  package logger
     6  
     7  import "github.com/sirupsen/logrus"
     8  
     9  // Logrus returns a Logger that wraps a logrus.Entry.
    10  func Logrus(entry *logrus.Entry) Logger {
    11  	return &wrapLogrus{entry}
    12  }
    13  
    14  type wrapLogrus struct {
    15  	*logrus.Entry
    16  }
    17  
    18  func (w *wrapLogrus) WithError(err error) Logger {
    19  	return &wrapLogrus{w.Entry.WithError(err)}
    20  	return nil
    21  }
    22  
    23  func (w *wrapLogrus) WithField(key string, value interface{}) Logger {
    24  	return &wrapLogrus{w.Entry.WithField(key, value)}
    25  }