|
@@ -0,0 +1,35 @@
|
|
|
+package go_chat_api_util
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/sirupsen/logrus"
|
|
|
+ "testing"
|
|
|
+)
|
|
|
+
|
|
|
+func TestNewLoggerByLogName(t *testing.T) {
|
|
|
+ type args struct {
|
|
|
+ path string
|
|
|
+ options []RotateOption
|
|
|
+ }
|
|
|
+
|
|
|
+ tests := []struct {
|
|
|
+ name string
|
|
|
+ args args
|
|
|
+ want *logrus.Logger
|
|
|
+ wantErr bool
|
|
|
+ }{
|
|
|
+ {name: "first", args: args{path: "/Users/kok/go/src/go_chat_api_util/logs/"}, wantErr: false},
|
|
|
+ }
|
|
|
+ for _, tt := range tests {
|
|
|
+ t.Run(tt.name, func(t *testing.T) {
|
|
|
+ got, err := NewLoggerByLogName(tt.args.path, tt.args.options...)
|
|
|
+ if (err != nil) != tt.wantErr {
|
|
|
+ t.Errorf("NewLoggerByLogName() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ got.Error("hello33")
|
|
|
+ //if !reflect.DeepEqual(got, tt.want) {
|
|
|
+ // t.Errorf("NewLoggerByLogName() got = %v, want %v", got, tt.want)
|
|
|
+ //}
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|