34 lines
661 B
Go
34 lines
661 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"tm/infra"
|
|
"tm/pkg/logger"
|
|
)
|
|
|
|
// Init Application Configuration
|
|
func intiConfig() infra.Config {
|
|
config, err := infra.LoadConfig("./")
|
|
if err != nil {
|
|
panic(fmt.Sprintf("Failed to load config: %v", err))
|
|
}
|
|
|
|
return *config
|
|
}
|
|
|
|
// Init Logger Service
|
|
func initLogger(conf infra.LoggingConfig) logger.Logger {
|
|
return logger.NewLogger(&logger.Config{
|
|
Level: conf.Level,
|
|
Format: conf.Format,
|
|
Output: conf.Output,
|
|
File: logger.FileConfig{
|
|
Path: conf.File.Path,
|
|
MaxSize: conf.File.MaxSize,
|
|
MaxBackups: conf.File.MaxBackups,
|
|
MaxAge: conf.File.MaxAge,
|
|
Compress: conf.File.Compress,
|
|
},
|
|
})
|
|
}
|