X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Flog%2Flogger.go;fp=cmd%2Fsafcm-remote%2Flog%2Flogger.go;h=0000000000000000000000000000000000000000;hb=9269fa3c94e700afc0be823f58ea473a2db8f3dc;hp=f358b75af7bad9cf35f47c4a1abd1a28c2311483;hpb=fd97e8019e2ab166d9475ed59782c86247d8430b;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/log/logger.go b/cmd/safcm-remote/log/logger.go deleted file mode 100644 index f358b75..0000000 --- a/cmd/safcm-remote/log/logger.go +++ /dev/null @@ -1,52 +0,0 @@ -// Logging helpers - -// Copyright (C) 2021 Simon Ruderich -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -package log - -import ( - "fmt" - - "ruderich.org/simon/safcm" -) - -// LogFunc is a helper type to reduce typing. -type LogFunc func(level safcm.LogLevel, msg string) - -type Logger struct { - fun LogFunc -} - -func NewLogger(fun LogFunc) *Logger { - return &Logger{ - fun: fun, - } -} - -func (l *Logger) Verbosef(format string, a ...interface{}) { - l.log(safcm.LogVerbose, format, a...) -} -func (l *Logger) Debugf(format string, a ...interface{}) { - l.log(safcm.LogDebug, format, a...) -} -func (l *Logger) Debug2f(format string, a ...interface{}) { - l.log(safcm.LogDebug2, format, a...) -} - -func (l *Logger) log(level safcm.LogLevel, - format string, a ...interface{}) { - l.fun(level, fmt.Sprintf(format, a...)) -}