pkg/logging: Remove unused methods
This commit is contained in:
parent
e969351f8e
commit
4fc937841a
2 changed files with 0 additions and 36 deletions
|
|
@ -65,24 +65,6 @@ func getKey(writer io.Writer, key any) (value any, ok bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func setKey(writer io.Writer, key, value any) bool {
|
|
||||||
uid, ok := id(writer)
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
writerDataMutex.Lock()
|
|
||||||
defer writerDataMutex.Unlock()
|
|
||||||
|
|
||||||
values, ok := writerDataData[uid]
|
|
||||||
if !ok {
|
|
||||||
values = make(map[any]any)
|
|
||||||
writerDataData[uid] = values
|
|
||||||
}
|
|
||||||
values[key] = value
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func upsetKey(writer io.Writer, key any, update func(value any, fresh bool) any) (any, bool) {
|
func upsetKey(writer io.Writer, key any, update func(value any, fresh bool) any) (any, bool) {
|
||||||
uid, ok := id(writer)
|
uid, ok := id(writer)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
||||||
|
|
@ -5,28 +5,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/rs/zerolog"
|
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Log[T any](operation func() T, name string, context context.Context) (res T) {
|
|
||||||
var took time.Duration
|
|
||||||
|
|
||||||
logger := zerolog.Ctx(context)
|
|
||||||
logger.Log().Msg(name)
|
|
||||||
defer func() {
|
|
||||||
logger.Log().Dur("took", took).Msg(name)
|
|
||||||
}()
|
|
||||||
|
|
||||||
start := time.Now()
|
|
||||||
res = operation()
|
|
||||||
took = time.Since(start)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// LogOperation logs a message that is displayed to the user, and then increases the log indent level.
|
// 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 {
|
func LogOperation(operation func() error, progress io.Writer, ctx context.Context, format string, args ...interface{}) error {
|
||||||
logOperation(progress, ctx, getIndent(progress), format, args...)
|
logOperation(progress, ctx, getIndent(progress), format, args...)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue