finalizing logging and multierror
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/coreos/go-systemd/journal"
|
||||
)
|
||||
|
||||
// Setup sets up/configures a SystemDLogger and prepares it for use.
|
||||
func (l *SystemDLogger) Setup() {
|
||||
|
||||
// NOOP
|
||||
@@ -14,6 +15,7 @@ func (l *SystemDLogger) Setup() {
|
||||
|
||||
}
|
||||
|
||||
// Shutdown cleanly shuts down a SystemDLogger.
|
||||
func (l *SystemDLogger) Shutdown() {
|
||||
|
||||
// NOOP
|
||||
@@ -21,14 +23,7 @@ func (l *SystemDLogger) Shutdown() {
|
||||
|
||||
}
|
||||
|
||||
func (l *SystemDLogger) DoDebug(d bool) {
|
||||
l.EnableDebug = d
|
||||
}
|
||||
|
||||
func (l *SystemDLogger) SetPrefix(prefix string) {
|
||||
l.Prefix = prefix
|
||||
}
|
||||
|
||||
// GetPrefix returns the prefix used by this SystemDLogger.
|
||||
func (l *SystemDLogger) GetPrefix() (prefix string) {
|
||||
|
||||
prefix = l.Prefix
|
||||
@@ -36,6 +31,20 @@ func (l *SystemDLogger) GetPrefix() (prefix string) {
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
DoDebug sets the debug state of this SystemDLogger.
|
||||
Note that this merely acts as a *safety filter* for debug messages to avoid sensitive information being written to the log.
|
||||
*/
|
||||
func (l *SystemDLogger) DoDebug(d bool) {
|
||||
l.EnableDebug = d
|
||||
}
|
||||
|
||||
// SetPrefix sets the prefix for this SystemDLogger.
|
||||
func (l *SystemDLogger) SetPrefix(prefix string) {
|
||||
l.Prefix = prefix
|
||||
}
|
||||
|
||||
// Alert writes an ALERT-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Alert(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -51,6 +60,7 @@ func (l *SystemDLogger) Alert(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Crit writes an CRITICAL-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Crit(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -66,6 +76,7 @@ func (l *SystemDLogger) Crit(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Debug writes a DEBUG-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Debug(s string, v ...interface{}) (err error) {
|
||||
|
||||
if !l.EnableDebug {
|
||||
@@ -85,6 +96,7 @@ func (l *SystemDLogger) Debug(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Emerg writes an EMERGENCY-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Emerg(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -100,6 +112,7 @@ func (l *SystemDLogger) Emerg(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Err writes an ERROR-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Err(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -115,6 +128,7 @@ func (l *SystemDLogger) Err(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Info writes an INFO-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Info(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -130,6 +144,7 @@ func (l *SystemDLogger) Info(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Notice writes a NOTICE-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Notice(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -145,6 +160,7 @@ func (l *SystemDLogger) Notice(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// Warning writes a WARNING/WARN-level message to this SystemDLogger.
|
||||
func (l *SystemDLogger) Warning(s string, v ...interface{}) (err error) {
|
||||
|
||||
var msg string
|
||||
@@ -160,6 +176,7 @@ func (l *SystemDLogger) Warning(s string, v ...interface{}) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// renderWrite prepares/formats a log message to be written to this SystemDLogger.
|
||||
func (l *SystemDLogger) renderWrite(msg string, prio journal.Priority) {
|
||||
|
||||
// TODO: implement code line, etc.
|
||||
|
||||
Reference in New Issue
Block a user