k3s/vendor/github.com/canonical/go-dqlite/client/log.go

31 lines
675 B
Go
Raw Normal View History

2019-11-08 21:45:10 +00:00
package client
import (
"fmt"
"log"
"os"
"github.com/canonical/go-dqlite/internal/logging"
)
// LogFunc is a function that can be used for logging.
type LogFunc = logging.Func
// LogLevel defines the logging level.
type LogLevel = logging.Level
// Available logging levels.
const (
LogDebug = logging.Debug
LogInfo = logging.Info
LogWarn = logging.Warn
LogError = logging.Error
)
// DefaultLogFunc emits messages using the stdlib's logger.
func DefaultLogFunc(l LogLevel, format string, a ...interface{}) {
logger := log.New(os.Stdout, "", log.LstdFlags|log.Lmicroseconds)
format = fmt.Sprintf("[%s]: %s", l.String(), format)
logger.Printf(format, a...)
}