github.com/searKing/golang/go@v1.2.117/log/slog/rotate.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package slog 6 7 import ( 8 "time" 9 ) 10 11 //go:generate go-option -type "rotate" 12 type rotate struct { 13 // Time layout to format rotate file 14 FilePathRotateLayout string 15 16 // sets the symbolic link name that gets linked to the current file name being used. 17 FileLinkPath string 18 19 // Rotate files are rotated until RotateInterval expired before being removed 20 // take effects if only RotateInterval is bigger than 0. 21 RotateInterval time.Duration 22 23 // Rotate files are rotated if they grow bigger then size bytes. 24 // take effects if only RotateSize is bigger than 0. 25 RotateSize int64 26 27 // max age of a log file before it gets purged from the file system. 28 // Remove rotated logs older than duration. The age is only checked if the file is 29 // to be rotated. 30 // take effects if only MaxAge is bigger than 0. 31 MaxAge time.Duration 32 33 // Rotate files are rotated MaxCount times before being removed 34 // take effects if only MaxCount is bigger than 0. 35 MaxCount int 36 37 // Force File Rotate when start up 38 ForceNewFileOnStartup bool 39 }