diff --git a/infra/logger/console.go b/infra/logger/console.go index 3218fe6..564d94a 100644 --- a/infra/logger/console.go +++ b/infra/logger/console.go @@ -4,10 +4,8 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "os" - "sync" ) -var cLock sync.Mutex var consoleLogCore *zap.Logger type consoleLogger struct { @@ -15,8 +13,6 @@ type consoleLogger struct { } func NewConsoleDriver(config console) (driver, error) { - cLock.Lock() - defer cLock.Unlock() if consoleLogCore == nil { coreEncoder := zap.NewProductionEncoderConfig() coreEncoder.EncodeLevel = zapcore.CapitalLevelEncoder diff --git a/infra/logger/file.go b/infra/logger/file.go index bd23adb..8644445 100644 --- a/infra/logger/file.go +++ b/infra/logger/file.go @@ -4,12 +4,10 @@ import ( "github.com/natefinch/lumberjack" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "sync" ) var ( fileLogCore *zap.Logger - fLock sync.Mutex ) type fileDriver struct { @@ -18,8 +16,6 @@ type fileDriver struct { } func NewFileDriver(config file, level int) (driver, error) { - fLock.Lock() - defer fLock.Unlock() if fileLogCore == nil { lumberjackLogger := &lumberjack.Logger{ Filename: config.Filename, diff --git a/infra/logger/mongo.go b/infra/logger/mongo.go index 57bf459..9db2b8e 100644 --- a/infra/logger/mongo.go +++ b/infra/logger/mongo.go @@ -5,18 +5,14 @@ import ( "fmt" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "sync" "time" ) var ( collection *mongo.Collection - mLock sync.Mutex ) func NewMongoDriver(config db, level int) (driver, error) { - mLock.Lock() - defer mLock.Unlock() if collection == nil { ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) client, err := mongo.Connect(ctx, options.Client().ApplyURI(fmt.Sprintf("mongodb://%s:%d", config.Host, config.Port)))