49 lines
971 B
Go
49 lines
971 B
Go
|
package logging
|
||
|
|
||
|
import (
|
||
|
`os`
|
||
|
`path/filepath`
|
||
|
`regexp`
|
||
|
)
|
||
|
|
||
|
// Flags for logger configuration
|
||
|
const (
|
||
|
LogUndefined types.MaskBit = 1 << iota
|
||
|
LogWinLogger
|
||
|
LogFile
|
||
|
LogStdout
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
defLogPaths = []string{
|
||
|
filepath.Join(os.Getenv("ALLUSERSPROFILE"), "golang", "program.log"), // C:\ProgramData\log\golang\program.log
|
||
|
filepath.Join(os.Getenv("LOCALAPPDATA"), "log", "golang", "program.log"), // C:\Users\<username>\AppData\Local\log\golang\program.log
|
||
|
}
|
||
|
)
|
||
|
|
||
|
var ptrnSourceExists *regexp.Regexp = regexp.MustCompile(`registry\skey\salready\sexists$`)
|
||
|
|
||
|
// Default WinEventID
|
||
|
var DefaultEventID *WinEventID = &WinEventID{
|
||
|
Alert: EventAlert,
|
||
|
Crit: EventCrit,
|
||
|
Debug: EventDebug,
|
||
|
Emerg: EventEmerg,
|
||
|
Err: EventErr,
|
||
|
Info: EventInfo,
|
||
|
Notice: EventNotice,
|
||
|
Warning: EventWarning,
|
||
|
}
|
||
|
|
||
|
// Default Event IDs for WinEventID.
|
||
|
const (
|
||
|
EventAlert uint32 = 1 << iota
|
||
|
EventCrit
|
||
|
EventDebug
|
||
|
EventEmerg
|
||
|
EventErr
|
||
|
EventInfo
|
||
|
EventNotice
|
||
|
EventWarning
|
||
|
)
|