You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
starlog/starlog.go

188 lines
5.4 KiB
Go

5 years ago
package starlog
import (
5 years ago
"io"
5 years ago
)
5 years ago
func (logger *StarLogger) SetShowColor(val bool) {
logger.logcore.showColor = val
5 years ago
}
5 years ago
func (logger *StarLogger) GetShowColor() bool {
return logger.logcore.showColor
5 years ago
}
func (logger *StarLogger) SetLevelColor(level int, color []Attr) {
logger.logcore.colorList[level] = color
logger.logcore.colorMe[level] = NewColor(color...)
5 years ago
}
5 years ago
func (logger *StarLogger) GetLevelColor(level int) []Attr {
return logger.logcore.colorList[level]
5 years ago
}
func (logger *StarLogger) SetWriter(wr io.Writer) {
logger.logcore.output = wr
5 years ago
}
func (logger *StarLogger) GetWriter() io.Writer {
return logger.logcore.output
5 years ago
}
func (logger *StarLogger) SetHandler(f func([]Attr, string)) {
logger.handlerFunc = f
5 years ago
}
func (logger *StarLogger) GetHandler() func([]Attr, string) {
return logger.handlerFunc
5 years ago
}
func (logger *StarLogger) SetSwitching(sw bool) {
logger.logcore.switching = sw
5 years ago
}
func (logger *StarLogger) SetShowOriginFile(val bool) {
logger.logcore.showDeatilFile = val
5 years ago
}
func (logger *StarLogger) GetShowOriginFile() bool {
return logger.logcore.showDeatilFile
5 years ago
}
func (logger *StarLogger) SetShowFuncName(val bool) {
logger.logcore.showFuncName = val
5 years ago
}
func (logger *StarLogger) GetShowFuncName() bool {
return logger.logcore.showFuncName
5 years ago
}
func (logger *StarLogger) SetShowLevel(val bool) {
logger.logcore.showLevel = val
5 years ago
}
func (logger *StarLogger) GetShowLevel() bool {
return logger.logcore.showLevel
5 years ago
}
func (logger *StarLogger) SetShowFlag(val bool) {
logger.logcore.showThread = val
5 years ago
}
func (logger *StarLogger) GetShowFlag() bool {
return logger.logcore.showThread
5 years ago
}
func (logger *StarLogger) SetShowStd(val bool) {
logger.logcore.showStd = val
5 years ago
}
func (logger *StarLogger) GetShowStd() bool {
return logger.logcore.showStd
5 years ago
}
func (logger *StarLogger) StopWrite() {
logger.logcore.stopWriter = true
5 years ago
}
func (logger *StarLogger) EnbaleWrite() {
logger.logcore.stopWriter = false
5 years ago
}
func (logger *StarLogger) IsWriteStoed() bool {
return logger.logcore.stopWriter
5 years ago
}
func (logger *StarLogger) Debug(str ...interface{}) {
logger.logcore.Debug(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Debugf(format string, str ...interface{}) {
logger.logcore.Debugf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Debugln(str ...interface{}) {
logger.logcore.Debugln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Info(str ...interface{}) {
logger.logcore.Info(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Infof(format string, str ...interface{}) {
logger.logcore.Infof(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Infoln(str ...interface{}) {
logger.logcore.Infoln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Notice(str ...interface{}) {
logger.logcore.Notice(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Noticef(format string, str ...interface{}) {
logger.logcore.Noticef(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Noticeln(str ...interface{}) {
logger.logcore.Noticeln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Warning(str ...interface{}) {
logger.logcore.Warning(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Warningf(format string, str ...interface{}) {
logger.logcore.Warningf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Warningln(str ...interface{}) {
logger.logcore.Warningln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Error(str ...interface{}) {
logger.logcore.Error(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Errorf(format string, str ...interface{}) {
logger.logcore.Errorf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Errorln(str ...interface{}) {
logger.logcore.Errorln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
func (logger *StarLogger) Critical(str ...interface{}) {
logger.logcore.Critical(logger.thread, logger.isStd, logger.handlerFunc, str...)
4 years ago
}
func (logger *StarLogger) Criticalf(format string, str ...interface{}) {
logger.logcore.Criticalf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
4 years ago
}
func (logger *StarLogger) Criticalln(str ...interface{}) {
logger.logcore.Criticalln(logger.thread, logger.isStd, logger.handlerFunc, str...)
4 years ago
}
func (logger *StarLogger) Fatal(str ...interface{}) {
logger.logcore.Fatal(logger.thread, logger.isStd, logger.handlerFunc, str...)
4 years ago
}
func (logger *StarLogger) Fatalf(format string, str ...interface{}) {
logger.logcore.Fatalf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
5 years ago
}
func (logger *StarLogger) Fatalln(str ...interface{}) {
logger.logcore.Fatalln(logger.thread, logger.isStd, logger.handlerFunc, str...)
5 years ago
}
4 years ago
func (logger *StarLogger) Print(str ...interface{}) {
logger.logcore.Print(logger.thread, logger.isStd, logger.handlerFunc, str...)
}
func (logger *StarLogger) Printf(format string, str ...interface{}) {
logger.logcore.Printf(logger.thread, logger.isStd, logger.handlerFunc, format, str...)
}
func (logger *StarLogger) Println(str ...interface{}) {
logger.logcore.Println(logger.thread, logger.isStd, logger.handlerFunc, str...)
}