3 // SPDX-License-Identifier: GPL-3.0-or-later
4 // Copyright (C) 2021-2024 Simon Ruderich
11 "ruderich.org/simon/safcm"
14 // LogFunc is a helper type to reduce typing.
15 type LogFunc func(level safcm.LogLevel, msg string)
21 func NewLogger(fun LogFunc) *Logger {
27 func (l *Logger) Verbosef(format string, a ...interface{}) {
28 l.log(safcm.LogVerbose, format, a...)
30 func (l *Logger) Debugf(format string, a ...interface{}) {
31 l.log(safcm.LogDebug, format, a...)
33 func (l *Logger) Debug2f(format string, a ...interface{}) {
34 l.log(safcm.LogDebug2, format, a...)
37 func (l *Logger) log(level safcm.LogLevel,
38 format string, a ...interface{}) {
39 l.fun(level, fmt.Sprintf(format, a...))