github.com/saucon/sauron@v0.0.7-alpha/log/log_test.go (about)

     1  package log_test
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/pkg/errors"
     6  	"github.com/saucon/sauron/log"
     7  	"github.com/sirupsen/logrus"
     8  	"testing"
     9  	"time"
    10  )
    11  
    12  func BenchmarkFunction(b *testing.B) {
    13  
    14  	logger := log.NewLogCustom(log.ConfigLog{}, false).SetFormatter(&logrus.JSONFormatter{})
    15  	err := errors.New("Error Baru nih")
    16  	timeStart := time.Now()
    17  
    18  	logger.Success(log.LogData{
    19  		Description: "main success",
    20  		StartTime:   timeStart,
    21  	})
    22  	logger.Error(log.LogData{
    23  		Description: "main error",
    24  		StartTime:   timeStart,
    25  		Err:         err,
    26  	})
    27  }
    28  
    29  func TestFunction(t *testing.T) {
    30  	br := testing.Benchmark(BenchmarkFunction)
    31  	fmt.Println(br)
    32  }