-
Notifications
You must be signed in to change notification settings - Fork 40
/
setter.go
63 lines (54 loc) · 2.17 KB
/
setter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// 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
// Change the sizeSplit fileLogger's bak file count
func (f *FileLogger) SetMaxFileCount(count int) int {
f.fileCount = count
return f.fileCount
}
// Change the sizeSplit fileLogger's single file size
func (f *FileLogger) SetMaxFileSize(size int64, unit UNIT) int64 {
f.fileSize = size * int64(unit)
return f.fileSize
}
// SetPrefix sets the output prefix for the logger.
func (f *FileLogger) SetPrefix(prefix string) {
f.lg.SetPrefix(prefix)
}
// SetFlags sets the output flags for the logger.
func (f *FileLogger) SetFlags(flag int) {
f.lg.SetFlags(flag)
}
// SetLogSeq sets the logChan's buffer size
func (f *FileLogger) SetLogSeq(logSeq int) {
//TODO How to change channel buffer size when channel has data
}
// SetLogScanInterval sets the ticker's interval
func (f *FileLogger) SetLogScanInterval(interval int) {
//TODO How to change logScan Interval when ticker is running
}
// SetLogLevel sets the output log's Level: TRACE<INFO<WARN<ERROR<OFF
func (f *FileLogger) SetLogLevel(level LEVEL) {
f.logLevel = level
}
// SetLogConsole sets whether the log string will print in console, default is false
func (f *FileLogger) SetLogConsole(console bool) {
f.logConsole = console
}
// Copy from go sdk
// These flags define which text to prefix to each log entry generated by the Logger.
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
)