pkg/logging: Remove unneeded argument

This commit is contained in:
Tom Wiesing 2023-03-13 13:24:19 +01:00
parent d7847b5d69
commit 2493cbb078
No known key found for this signature in database
15 changed files with 75 additions and 76 deletions

View file

@ -1,7 +1,6 @@
package logging
import (
"context"
"fmt"
"io"
"strings"
@ -10,8 +9,8 @@ import (
)
// LogOperation logs a message that is displayed to the user, and then increases the log indent level.
func LogOperation(operation func() error, progress io.Writer, ctx context.Context, format string, args ...interface{}) error {
logOperation(progress, ctx, getIndent(progress), format, args...)
func LogOperation(operation func() error, progress io.Writer, format string, args ...interface{}) error {
logOperation(progress, getIndent(progress), format, args...)
incIndent(progress)
defer decIndent(progress)
@ -19,11 +18,11 @@ func LogOperation(operation func() error, progress io.Writer, ctx context.Contex
}
// LogMessage logs a message that is displayed to the user
func LogMessage(progress io.Writer, ctx context.Context, format string, args ...interface{}) (int, error) {
return logOperation(progress, ctx, getIndent(progress), format, args...)
func LogMessage(progress io.Writer, format string, args ...interface{}) (int, error) {
return logOperation(progress, getIndent(progress), format, args...)
}
func logOperation(progress io.Writer, ctx context.Context, indent int, format string, args ...interface{}) (int, error) {
func logOperation(progress io.Writer, indent int, format string, args ...interface{}) (int, error) {
message := "\033[1m" + strings.Repeat(" ", indent+1) + "=> " + format + "\033[0m\n"
if !streamIsTerminal(progress) {
message = " => " + format + "\n"