Skip to content

Commit e68ddcb

Browse files
committed
Add filename API for zap
1 parent b20f36a commit e68ddcb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

zaplog.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ func init() {
4040
}
4141
}
4242

43+
// InitZapLogWithFilename initializes the zap logger with a file name and default log level
44+
func InitZapLogWithFilename(fileName string) (err error) {
45+
return InitZapLogLevelWithFilename(fileName, level)
46+
}
47+
48+
// InitZapLogLevelWithFilename initializes the zap logger with a file name and log level
4349
func InitZapLogLevelWithFilename(fileName string, levelIn zapcore.Level) (err error) {
4450
level = levelIn
4551
p := os.Getenv("LOGPATH")
@@ -59,12 +65,14 @@ func InitZapLogLevelWithFilename(fileName string, levelIn zapcore.Level) (err er
5965
return InitZapLogWithFile(name)
6066
}
6167

68+
// InitZapLogLevelWithFile initializes the zap logger with a file and log level
6269
func InitZapLogLevelWithFile(fileName string, levelIn zapcore.Level) (err error) {
6370
level = levelIn
6471

6572
return InitZapLogWithFile(fileName)
6673
}
6774

75+
// InitZapLogWithFile initializes the zap logger with a file
6876
func InitZapLogWithFile(name string) (err error) {
6977
lumberLog := &lumberjack.Logger{
7078
Filename: name, // Location of the log file

0 commit comments

Comments
 (0)