1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-10 22:25:49 +01:00
dnscrypt-proxy/vendor/github.com/jedisct1/dlog/sysdeps_windows.go

31 lines
828 B
Go
Raw Normal View History

package dlog
import "golang.org/x/sys/windows/svc/eventlog"
type systemLogger struct {
inner *eventlog.Log
}
func newSystemLogger(appName string, facility string) (*systemLogger, error) {
2018-01-19 20:27:48 +01:00
eventlog.InstallAsEventCreate(appName, eventlog.Error|eventlog.Warning|eventlog.Info)
var eventLogger *eventlog.Log
2018-01-19 20:27:48 +01:00
var err error
if eventLogger, err = eventlog.Open(appName); err != nil {
return nil, err
}
return &systemLogger{inner: eventLogger}, nil
}
func (systemLogger *systemLogger) writeString(severity Severity, message string) {
switch severity {
case SeverityError:
case SeverityCritical:
case SeverityFatal:
systemLogger.inner.Error(uint32(severity), message)
case SeverityWarning:
systemLogger.inner.Warning(uint32(severity), message)
default:
systemLogger.inner.Info(uint32(severity), message)
}
}