fix .log ending for empty parameter in linux systems
This commit is contained in:
@@ -35,7 +35,11 @@ func NewLogger(file string, cfg *Config) (*Logger, error) {
|
||||
|
||||
if file == "" {
|
||||
file = os.Args[0]
|
||||
file = strings.Replace(filepath.Base(file), filepath.Ext(file), ".log", 1)
|
||||
if filepath.Ext(file) != "" {
|
||||
file = strings.Replace(filepath.Base(file), filepath.Ext(file), ".log", 1)
|
||||
} else {
|
||||
file = filepath.Base(file) + ".log"
|
||||
}
|
||||
}
|
||||
|
||||
encoderConfig := zap.NewProductionEncoderConfig()
|
||||
|
||||
Reference in New Issue
Block a user