netmaker/logger/util.go
2022-04-21 17:48:36 -04:00

30 lines
653 B
Go

package logger
import (
"strings"
"github.com/gravitl/netmaker/servercfg"
)
// Verbosity - current logging verbosity level (optionally set)
var Verbosity = 0
// MakeString - makes a string using golang string builder
func MakeString(delimeter string, message ...string) string {
var builder strings.Builder
for i := range message {
builder.WriteString(message[i])
if delimeter != "" && i != len(message)-1 {
builder.WriteString(delimeter)
}
}
return builder.String()
}
func getVerbose() int32 {
if Verbosity >= 1 && Verbosity <= 3 {
return int32(Verbosity)
}
Verbosity = int(servercfg.GetVerbosity())
return int32(Verbosity)
}