Update Logger functions to use Sprintf.

This commit is contained in:
Daniel Theophanes
2012-03-09 23:35:27 -08:00
parent b790f755c5
commit e5ca8cfda8
2 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ type Service interface {
Run(onStart, onStop func() error) error
// Basic log functions in the context of the service.
LogError(text string) error
LogWarning(text string) error
LogInfo(text string) error
LogError(format string, a ...interface{}) error
LogWarning(format string, a ...interface{}) error
LogInfo(format string, a ...interface{}) error
}
+7 -6
View File
@@ -3,6 +3,7 @@ package service
import (
"syscall"
"unicode/utf16"
"fmt"
"unsafe"
)
@@ -93,14 +94,14 @@ func (ws *windowsService) Run(onStart, onStop func() error) error {
return runService(ws.name, onStart, onStop)
}
func (ws *windowsService) LogError(text string) error {
return writeToEventLog(ws.name, text, levelError)
func (ws *windowsService) LogError(format string, a ...interface{}) error {
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelError)
}
func (ws *windowsService) LogWarning(text string) error {
return writeToEventLog(ws.name, text, levelWarning)
func (ws *windowsService) LogWarning(format string, a ...interface{}) error {
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelWarning)
}
func (ws *windowsService) LogInfo(text string) error {
return writeToEventLog(ws.name, text, levelInfo)
func (ws *windowsService) LogInfo(format string, a ...interface{}) error {
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelInfo)
}
var (