github.com/drone/runner-go@v1.12.0/logger/logrus_test.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 (
     8  	"testing"
     9  
    10  	"github.com/sirupsen/logrus"
    11  )
    12  
    13  func TestLogrus(t *testing.T) {
    14  	logger := Logrus(
    15  		logrus.NewEntry(
    16  			logrus.StandardLogger(),
    17  		),
    18  	)
    19  	if _, ok := logger.(*wrapLogrus); !ok {
    20  		t.Errorf("Expect wrapped logrus")
    21  	}
    22  	if _, ok := logger.WithError(nil).(*wrapLogrus); !ok {
    23  		t.Errorf("Expect WithError wraps logrus")
    24  	}
    25  	if _, ok := logger.WithField("foo", "bar").(*wrapLogrus); !ok {
    26  		t.Errorf("Expect WithField logrus")
    27  	}
    28  }