mirror of
https://github.com/callebtc/electronwall.git
synced 2026-01-31 12:54:54 +01:00
helpers
This commit is contained in:
29
helpers.go
Normal file
29
helpers.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user