mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve details for package glog
This commit is contained in:
@ -41,7 +41,7 @@ type Config struct {
|
||||
RotateBackupLimit int `json:"rotateBackupLimit"` // Max backup for rotated files, default is 0, means no backups.
|
||||
RotateBackupExpire time.Duration `json:"rotateBackupExpire"` // Max expire for rotated files, which is 0 in default, means no expiration.
|
||||
RotateBackupCompress int `json:"rotateBackupCompress"` // Compress level for rotated files using gzip algorithm. It's 0 in default, means no compression.
|
||||
RotateCheckInterval time.Duration `json:"rotateCheckInterval"` // Asynchronizely checks the backups and expiration at intervals. It's 1 hour in default.
|
||||
RotateCheckInterval time.Duration `json:"rotateCheckInterval"` // Asynchronous checks the backups and expiration at intervals. It's 1 hour in default.
|
||||
}
|
||||
|
||||
// DefaultConfig returns the default configuration for logger.
|
||||
@ -104,8 +104,7 @@ func (l *Logger) SetConfigWithMap(m map[string]interface{}) error {
|
||||
return errors.New(fmt.Sprintf(`invalid rotate size: %v`, rotateSizeValue))
|
||||
}
|
||||
}
|
||||
err := gconv.Struct(m, &l.config)
|
||||
if err != nil {
|
||||
if err := gconv.Struct(m, &l.config); err != nil {
|
||||
return err
|
||||
}
|
||||
return l.SetConfig(l.config)
|
||||
|
||||
@ -62,8 +62,10 @@ var levelStringMap = map[string]int{
|
||||
}
|
||||
|
||||
// SetLevel sets the logging level.
|
||||
// Note that levels ` LEVEL_CRIT | LEVEL_PANI | LEVEL_FATA ` cannot be removed for logging content,
|
||||
// which are automatically added to levels.
|
||||
func (l *Logger) SetLevel(level int) {
|
||||
l.config.Level = level
|
||||
l.config.Level = level | LEVEL_CRIT | LEVEL_PANI | LEVEL_FATA
|
||||
}
|
||||
|
||||
// GetLevel returns the logging level value.
|
||||
|
||||
Reference in New Issue
Block a user