This commit is contained in:
callebtc
2022-07-08 15:51:16 +02:00
parent 496ae56c7b
commit e2925f8314

29
helpers.go Normal file
View File

@@ -0,0 +1,29 @@
package main
import (
"encoding/hex"
"fmt"
log "github.com/sirupsen/logrus"
)
func trimPubKey(pubkey []byte) string {
return fmt.Sprintf("%s...%s", hex.EncodeToString(pubkey)[:6], hex.EncodeToString(pubkey)[len(hex.EncodeToString(pubkey))-6:])
}
func welcome() {
log.Info("---- ⚡️ electronwall 0.3 ⚡️ ----")
}
// setLogger will initialize the log format
func setLogger(debug bool) {
if debug {
log.SetLevel(log.DebugLevel)
} else {
log.SetLevel(log.InfoLevel)
}
customFormatter := new(log.TextFormatter)
customFormatter.TimestampFormat = "2006-01-02 15:04:05"
customFormatter.FullTimestamp = true
log.SetFormatter(customFormatter)
}