File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ package log
2+
3+ import (
4+ "testing"
5+
6+ "github.com/cybertec-postgresql/pg_timetable/internal/config"
7+ "github.com/sirupsen/logrus"
8+ "github.com/stretchr/testify/assert"
9+ "gopkg.in/natefinch/lumberjack.v2"
10+ )
11+
12+ func TestGetLogFileWriter (t * testing.T ) {
13+ assert .IsType (t , getLogFileWriter (config.LoggingOpts {LogFileRotate : true }), & lumberjack.Logger {})
14+ assert .IsType (t , getLogFileWriter (config.LoggingOpts {LogFileRotate : false }), "string" )
15+ }
16+
17+ func TestGetLogFileFormatter (t * testing.T ) {
18+ assert .IsType (t , getLogFileFormatter (config.LoggingOpts {LogFileFormat : "json" }), & logrus.JSONFormatter {})
19+ assert .IsType (t , getLogFileFormatter (config.LoggingOpts {LogFileFormat : "blah" }), & logrus.JSONFormatter {})
20+ assert .IsType (t , getLogFileFormatter (config.LoggingOpts {LogFileFormat : "text" }), & logrus.TextFormatter {})
21+ }
You can’t perform that action at this time.
0 commit comments