add conf.PrintInfo

This commit is contained in:
david.yan 2025-03-27 03:08:59 +08:00
parent 33d1b2e0ee
commit e184fff689
1 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"git.apinb.com/bsm-sdk/core/env"
"git.apinb.com/bsm-sdk/core/print"
"git.apinb.com/bsm-sdk/core/utils"
"git.apinb.com/bsm-sdk/core/vars"
yaml "gopkg.in/yaml.v3"
)
@ -56,6 +57,12 @@ func NotNil(values ...string) {
}
}
func PrintInfo(port int) {
print.Info("[BSM - %s] Service Name: %s", vars.ServiceKey, vars.ServiceKey)
print.Info("[BSM - %s] Runtime Mode: %s", vars.ServiceKey, env.Runtime.Mode)
print.Info("[BSM - %s] Listen Addr: %s:%d", vars.ServiceKey, utils.GetLocationIP(), port)
}
func CheckPort(port int) int {
if port <= 0 || port >= 65535 {
r := rand.New(rand.NewPCG(1000, uint64(time.Now().UnixNano())))