Documentation
¶
Overview ¶
Package: fileLogger File: fileLogger.go Created by: mint(mint.zhao.chiu@gmail.com)_aiwuTech Useage: DATE: 14-8-23 17:20
Package: fileLogger File: setter.go Created by: mint(mint.zhao.chiu@gmail.com)_aiwuTech Useage: fileLogger settings DATE: 14-8-24 11:14
Package: fileLogger File: util.go Created by: mint(mint.zhao.chiu@gmail.com)_aiwuTech Useage: some useful utils DATE: 14-8-23 17:03
Package: fileLogger File: writer.go Created by: mint(mint.zhao.chiu@gmail.com)_aiwuTech Useage: DATE: 14-8-24 12:40
Index ¶
- Constants
- type FileLogger
- func (f *FileLogger) Close() error
- func (f *FileLogger) E(format string, v ...interface{})
- func (f *FileLogger) Error(format string, v ...interface{})
- func (f *FileLogger) I(format string, v ...interface{})
- func (f *FileLogger) Info(format string, v ...interface{})
- func (f *FileLogger) Print(v ...interface{})
- func (f *FileLogger) Printf(format string, v ...interface{})
- func (f *FileLogger) Println(v ...interface{})
- func (f *FileLogger) SetFlags(flag int)
- func (f *FileLogger) SetLogConsole(console bool)
- func (f *FileLogger) SetLogLevel(level LEVEL)
- func (f *FileLogger) SetLogScanInterval(interval int)
- func (f *FileLogger) SetLogSeq(logSeq int)
- func (f *FileLogger) SetMaxFileCount(count int) int
- func (f *FileLogger) SetMaxFileSize(size int64, unit UNIT) int64
- func (f *FileLogger) SetPrefix(prefix string)
- func (f *FileLogger) T(format string, v ...interface{})
- func (f *FileLogger) Trace(format string, v ...interface{})
- func (f *FileLogger) W(format string, v ...interface{})
- func (f *FileLogger) Warn(format string, v ...interface{})
- type LEVEL
- type SplitType
- type UNIT
Constants ¶
const ( DATEFORMAT = "2006-01-02" DEFAULT_FILE_COUNT = 10 DEFAULT_FILE_SIZE = 50 DEFAULT_FILE_UNIT = MB DEFAULT_LOG_SCAN = 300 DEFAULT_LOG_SEQ = 5000 DEFAULT_LOG_LEVEL = TRACE )
const ( // Bits or'ed together to control what's printed. There is no control over the // order they appear (the order listed here) or the format they present (as // described in the comments). A colon appears after these items: // 2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message Ldate = 1 << iota // the date: 2009/01/23 Ltime // the time: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile LstdFlags = Ldate | Ltime // initial values for the standard logger )
Copy from go sdk These flags define which text to prefix to each log entry generated by the Logger.
const (
DEFAULT_PRINT_INTERVAL = 300
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
func NewDailyLogger ¶
func NewDailyLogger(fileDir, fileName, prefix string, logScan int64, logSeq int) *FileLogger
NewDailyLogger return a logger split by daily Parameters:
file directory file name log's prefix
func NewDefaultLogger ¶
func NewDefaultLogger(fileDir, fileName string) *FileLogger
NewDefaultLogger return a logger split by fileSize by default
func NewSizeLogger ¶
func NewSizeLogger(fileDir, fileName, prefix string, fileCount int, fileSize int64, unit UNIT, logScan int64, logSeq int) *FileLogger
NewSizeLogger return a logger split by fileSize Parameters:
file directory file name log's prefix fileCount holds maxCount of bak file fileSize holds each of bak file's size unit stands for kb, mb, gb, tb logScan after a logScan time will check fileLogger isMustSplit, default is 300s
func (*FileLogger) Print ¶
func (f *FileLogger) Print(v ...interface{})
Print throw logstr to channel to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*FileLogger) Printf ¶
func (f *FileLogger) Printf(format string, v ...interface{})
Printf throw logstr to channel to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*FileLogger) Println ¶
func (f *FileLogger) Println(v ...interface{})
Println throw logstr to channel to print to the logger. Arguments are handled in the manner of fmt.Println.
func (*FileLogger) SetFlags ¶
func (f *FileLogger) SetFlags(flag int)
SetFlags sets the output flags for the logger.
func (*FileLogger) SetLogConsole ¶
func (f *FileLogger) SetLogConsole(console bool)
SetLogConsole sets whether the log string will print in console, default is false
func (*FileLogger) SetLogLevel ¶
func (f *FileLogger) SetLogLevel(level LEVEL)
SetLogLevel sets the output log's Level: TRACE<INFO<WARN<ERROR<OFF
func (*FileLogger) SetLogScanInterval ¶
func (f *FileLogger) SetLogScanInterval(interval int)
SetLogScanInterval sets the ticker's interval
func (*FileLogger) SetLogSeq ¶
func (f *FileLogger) SetLogSeq(logSeq int)
SetLogSeq sets the logChan's buffer size
func (*FileLogger) SetMaxFileCount ¶
func (f *FileLogger) SetMaxFileCount(count int) int
Change the sizeSplit fileLogger's bak file count
func (*FileLogger) SetMaxFileSize ¶
func (f *FileLogger) SetMaxFileSize(size int64, unit UNIT) int64
Change the sizeSplit fileLogger's single file size
func (*FileLogger) SetPrefix ¶
func (f *FileLogger) SetPrefix(prefix string)
SetPrefix sets the output prefix for the logger.
func (*FileLogger) Trace ¶
func (f *FileLogger) Trace(format string, v ...interface{})
====================================================================================================================== Trace log