)
// LogFunc is a helper type to reduce typing.
-type LogFunc func(level safcm.LogLevel, format string, a ...interface{})
+type LogFunc func(level safcm.LogLevel, msg string)
type Logger struct {
fun LogFunc
func (l *Logger) log(level safcm.LogLevel,
format string, a ...interface{}) {
- l.fun(level, "%s %s", l.prefix, fmt.Sprintf(format, a...))
+ l.fun(level, l.prefix+" "+fmt.Sprintf(format, a...))
}
conn := safcm.NewGobConn(os.Stdin, os.Stdout)
var logLevel safcm.LogLevel
- logFunc := func(level safcm.LogLevel, format string, a ...interface{}) {
+ logFunc := func(level safcm.LogLevel, msg string) {
if logLevel >= level {
conn.Send(safcm.MsgLog{
Level: level,
- Text: fmt.Sprintf(format, a...),
+ Text: msg,
})
}
}
}()
logger := log.NewLogger(logPrefix,
- func(level safcm.LogLevel, format string, a ...interface{}) {
- res.ch <- fmt.Sprintf("%d: %s", level,
- fmt.Sprintf(format, a...))
+ func(level safcm.LogLevel, msg string) {
+ res.ch <- fmt.Sprintf("%d: %s", level, msg)
})
return &Sync{
req: req,