Documentation ¶
Index ¶
- Constants
- type Logger
- func (l *Logger) Close()
- func (l *Logger) Fatal(txt ...interface{})
- func (l *Logger) Fatalf(format string, txt ...interface{})
- func (l *Logger) Fatalln(txt ...interface{})
- func (l *Logger) GetTypeString(typeLog int) string
- func (l *Logger) Print(typeLog int, txt ...interface{})
- func (l *Logger) Printf(typeLog int, format string, txt ...interface{})
- func (l *Logger) Println(typeLog int, txt ...interface{})
- func (l *Logger) SetCompressModeGzip()
- func (l *Logger) SetCompressModeZip()
- func (l *Logger) SetLevel(lvl int)
- func (l *Logger) SetMaxDepth(m int)
- func (l *Logger) SetOutputTerm()
- func (l *Logger) SetRemoveAfter(day uint16)
- func (l *Logger) SetStackTrace(list int)
- func (l *Logger) SetTimeSync(t time.Duration)
- func (l *Logger) WritePanic(rec interface{}, stack []byte)
Constants ¶
const ( ACCESS = 1 << iota // 1 FATAL // 2 ERROR // 4 WARN // 8 INFO // 16 DEBUG // 32 )
const ( TIME_SYNC = time.Second LOG_FLAGS = log.LstdFlags DEFAULT_MAXDEPTH = 3 DEFAULT_STACKTRACE = true LEVEL_ALL = ACCESS | FATAL | ERROR | WARN | INFO | DEBUG LEVEL_PRODUCTION = LEVEL_ALL ^ DEBUG DEFAULT_WRITESTACKTRACE = ERROR | WARN )
const ( COMPRESS_GZIP = iota COMPRESS_ZIP )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Struct Logger
func New ¶
Creates a new instance of logger fp is file with complete path. Ex: /var/log/mylog.log level define which log types to write to the file. Ex: logger.FATAL|logger.INFO. rotate define whether to rotate the log automatically or not
func (*Logger) Fatal ¶
func (l *Logger) Fatal(txt ...interface{})
Same as the Print function but after writing to the file, it kills the application with an Exit (1)
func (*Logger) Fatalf ¶
Same as the Printf function but after writing to the file, it kills the application with an Exit (1)
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(txt ...interface{})
Same as the Println function but after writing to the file, it kills the application with an Exit (1)
func (*Logger) GetTypeString ¶
func (*Logger) Printf ¶
typeLog is a level log. Ex:INFO, ERROR, WARN format is text format txt is variables that will be formatted
func (*Logger) SetCompressModeGzip ¶
func (l *Logger) SetCompressModeGzip()
define gzip as compression mode note: works only with active file rotation
func (*Logger) SetCompressModeZip ¶
func (l *Logger) SetCompressModeZip()
define zip as compression mode note: works only with active file rotation
func (*Logger) SetRemoveAfter ¶
define max day to remove files after rotate
func (*Logger) SetStackTrace ¶
define log types write stack trace
func (*Logger) SetTimeSync ¶
Define sync time to save log in file