github.com/pavlo67/common@v0.5.3/common/logger/logger_zap/zap_test.go (about)

     1  package logger_zap
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/pavlo67/common/common/logger"
     9  )
    10  
    11  func TestLoggerZapOutputPaths(t *testing.T) {
    12  
    13  	testKey := "testKey"
    14  
    15  	cfg := logger.Config{
    16  		Key:         testKey,
    17  		LogLevel:    logger.InfoLevel,
    18  		OutputPaths: []string{"test.log", "stdout"},
    19  		//ErrorOutputPaths: nil,
    20  		//Encoding:         "",
    21  	}
    22  	l, err := New(cfg)
    23  	require.NoError(t, err)
    24  	require.NotNil(t, l)
    25  
    26  	require.Equal(t, testKey, l.Key())
    27  
    28  	l.Comment("INITIAL BLOCK")
    29  
    30  	l.Info("IT'S TEST FOR LOGGING INFO. OK!")
    31  
    32  	l.Comment("NEXT BLOCK")
    33  
    34  	l.Error("IT'S TEST FOR LOGGING ERROR. OK!")
    35  }