2022-02-11 00:07:21 +08:00
|
|
|
package logger
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2022-03-24 23:34:22 +08:00
|
|
|
// Verbosity - current logging verbosity level (optionally set)
|
2022-03-24 23:31:07 +08:00
|
|
|
var Verbosity = 0
|
|
|
|
|
2022-02-11 00:07:21 +08:00
|
|
|
// MakeString - makes a string using golang string builder
|
|
|
|
func MakeString(delimeter string, message ...string) string {
|
|
|
|
var builder strings.Builder
|
2022-02-12 04:20:19 +08:00
|
|
|
for i := range message {
|
2022-02-11 00:07:21 +08:00
|
|
|
builder.WriteString(message[i])
|
|
|
|
if delimeter != "" && i != len(message)-1 {
|
|
|
|
builder.WriteString(delimeter)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return builder.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
func getVerbose() int32 {
|
2022-07-14 05:22:17 +08:00
|
|
|
if Verbosity >= 1 && Verbosity <= 4 {
|
2022-03-24 23:31:07 +08:00
|
|
|
return int32(Verbosity)
|
|
|
|
}
|
2022-04-22 04:25:51 +08:00
|
|
|
return int32(Verbosity)
|
2022-02-11 00:07:21 +08:00
|
|
|
}
|