Skip to content

Commit

Permalink
chore: use LogrusLogger or ZapLogger only instead of Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayheaven committed Jan 19, 2024
1 parent 5ffa9ee commit f415663
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
8 changes: 3 additions & 5 deletions internal/pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ var (
ZapSugar *zap.SugaredLogger

LogrusLogger *logrus.Logger

// export Logger
Logger *logrus.Logger
)

func init() {
Logger = InitLogrusLogger()
LogrusLogger = InitLogrusLogger()

LogrusLogger = Logger
// ZapLogger = InitZapLogger()
// ZapSugar = ZapLogger.Sugar()
}
1 change: 0 additions & 1 deletion internal/pkg/logger/logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func InitLogrusLogger() *logrus.Logger {

logger.SetLevel(logrus.TraceLevel)
logger.SetFormatter(&logrus.JSONFormatter{})
// logger.SetReportCaller(true)

logFile := &lumberjack.Logger{
Filename: "logs/app.log",
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var DB *gorm.DB

func Connect(config *configs.Mongo) {

logger := logger.Logger
logger := logger.LogrusLogger

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var DB *gorm.DB

func Connect(config *configs.Mysql) *gorm.DB {

logger := logger.Logger
logger := logger.LogrusLogger

address := fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local",
config.User,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func Connect(config *configs.Redis) *redis.Client {

logger := logger.Logger
logger := logger.LogrusLogger

address := fmt.Sprintf("%s:%d", config.Host, config.Port)

Expand Down

0 comments on commit f415663

Please sign in to comment.