logging
v0.0.0-20210324171325-c8f221b42a4a
code.afis.me/logging
Documentation
pkg.go.dev ↗Constants
LOGDEBUG (5 declarations)
const ( // LOGDEBUG - LOGDEBUG = iota // LOGWARNING - LOGWARNING // LOGERROR - LOGERROR // LOGSUCCESS - LOGSUCCESS // LOGNOTICE - LOGNOTICE )
LEVELDEBUG (4 declarations)
const ( // LEVELDEBUG - LEVELDEBUG = iota // LEVELWARNING - LEVELWARNING // LEVELERROR - LEVELERROR // LEVELNOTICE - LEVELNOTICE )
Functions
GetLevelLogName
func GetLevelLogName(level int) (lv string)
GetLevelLogName -
OutputHandlerConsole
func OutputHandlerConsole(ps *PushLogs)
OutputHandlerConsole -
ParsingLogs
func ParsingLogs(ps *PushLogs, opt ParsingOption) (raw string)
ParsingLogs -
TimeStringDateOnly
func TimeStringDateOnly(dur time.Time) (format string)
TimeStringDateOnly -
TimeStringTimeOnly
func TimeStringTimeOnly(dur time.Time) (format string)
TimeStringTimeOnly -
TimeStringWitLongDate
func TimeStringWitLongDate(dur time.Time) (format string)
TimeStringWitLongDate -
TimeStringWithDate
func TimeStringWithDate(dur time.Time) (format string)
TimeStringWithDate -
TimeToString
func TimeToString(s time.Time) (ts string)
TimeToString -
Types
LogStore
type LogStore struct {
Counting int64
OnNewLogs func(value interface{})
sync.RWMutex
// contains filtered or unexported fields
}
LogStore -
NewLogsStore
func NewLogsStore(maxlogsize int64) *LogStore
NewLogsStore -
LogStore.ClearLogs
func (rm *LogStore) ClearLogs(id string, ts []int64)
ClearLogs -
LogStore.Count
func (rm *LogStore) Count() int64
Count -
LogStore.LoadAll
func (rm *LogStore) LoadAll(lid string, start int64, limit int) (value []LogsValue)
LoadAll -
LogStore.RemoveByID
func (rm *LogStore) RemoveByID(lid string)
RemoveByID -
LogStore.Reset
func (rm *LogStore) Reset()
Reset -
LogStore.Store
func (rm *LogStore) Store(printWhenStore bool, key string, value interface{})
Store -
Logger
type Logger struct {
Name string
Splitter []string
LogLevel int
OutputHandler func(*PushLogs)
}
Logger -
NewLogger
func NewLogger(name string, spli interface{}) *Logger
NewLogger -
Logger.AlwaysShow
func (cc *Logger) AlwaysShow(level int, msg string) *Logger
AlwaysShow -
Logger.CreateHash
func (cc *Logger) CreateHash(key string) string
CreateHash -
Logger.Debug
func (cc *Logger) Debug(msg string) *Logger
Debug -
Logger.Error
func (cc *Logger) Error(err error) *Logger
Logger.GenerateUUID
func (cc *Logger) GenerateUUID() string
GenerateUUID -
Logger.MakeID
func (cc *Logger) MakeID() string
MakeID -
Logger.Notice
func (cc *Logger) Notice(msg string) *Logger
Notice -
Logger.Output
func (cc *Logger) Output(ps *PushLogs) *Logger
Output -
Logger.Quit
func (cc *Logger) Quit(err error) error
Quit -
Logger.SetLevel
func (cc *Logger) SetLevel(ps int) *Logger
SetLevel -
Logger.Success
func (cc *Logger) Success(msg string) *Logger
Success -
Logger.Warning
func (cc *Logger) Warning(msg string) *Logger
Warning -
LogsMap
type LogsMap map[time.Time]interface{}
LogsMap -
LogsValue
type LogsValue struct {
ID string
Time time.Time
Value interface{}
}
LogsValue -
ParsingOption
type ParsingOption struct {
Name func(string) string
}
ParsingOption -
PushLogs
type PushLogs struct {
ID string `json:"id"`
Origin string `json:"origin"`
Name string `json:"name"`
Time time.Time `json:"time"`
Level int `json:"level"`
LongFile string `json:"longFile"`
ShortFile string `json:"shortFile"`
LineNumber int `json:"lineNumber"`
Message string `json:"message"`
}
PushLogs -
TimeString
type TimeString struct {
Date time.Time
// contains filtered or unexported fields
}
TimeString -
NewTimeString
func NewTimeString(tt time.Time) *TimeString
NewTimeString -
TimeString.Output
func (cc *TimeString) Output() (sr string)
Output -
TimeString.WithDate
func (cc *TimeString) WithDate(sp, sp2 string) *TimeString
WithDate -
TimeString.WithLongDate
func (cc *TimeString) WithLongDate(sp, sp2 string) *TimeString
WithLongDate -
TimeString.WithMilliSecond
func (cc *TimeString) WithMilliSecond() *TimeString
WithMilliSecond -
TimeString.WithTime
func (cc *TimeString) WithTime() *TimeString
WithTime -