提交 cf6791fd 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

tree node style

上级 b8819c2c
......@@ -39,6 +39,7 @@ export function startZtfServer() {
const lines = dataString.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
console.log('\t>', line);
if (line.includes('Now listening on: http')) {
resolve(line.split('Now listening on:')[1].trim());
break;
......@@ -73,6 +74,7 @@ export function startZtfServer() {
const lines = dataString.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
console.log('\t>', line);
if (line.includes('Now listening on: http')) {
resolve(line.split('Now listening on:')[1].trim());
break;
......@@ -152,6 +154,7 @@ export function getUIServerUrl() {
const lines = dataString.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
console.log('\t>', line);
if (line.includes('App running at:')) {
const nextLine = lines[i + 1] || lines[i + 2];
if (!nextLine) {
......
......@@ -22,6 +22,7 @@ func main() {
if webServer == nil {
return
}
injectModule(webServer)
webServer.Run()
......
......@@ -21,7 +21,7 @@ func GetCrontabInstance() *cron.Cron {
func AddTask(name string, schedule string, f func()) {
if _, ok := taskFunc[name]; !ok {
fmt.Println("Add a new task:", name)
fmt.Printf("Add a new task %s", name)
cInstance := GetCrontabInstance()
cInstance.AddFunc(schedule, f)
......
......@@ -13,6 +13,7 @@ import (
var I118Prt *message.Printer
func Init(lang string, app string) {
langRes := filepath.Join("res", app, lang, "messages.json")
bytes, _ := resUtils.ReadRes(langRes)
......
......@@ -12,41 +12,32 @@ var Logger *zap.Logger
func Info(str string) {
Logger.Info(str)
//log.Println(str)
log.Println(str)
}
func Infof(str string, args ...interface{}) {
msg := fmt.Sprintf(str, args...)
Logger.Info(msg)
//log.Printf(msg+"\n")
log.Println(msg)
}
func Warn(str string) {
Logger.Warn(str)
//log.Println(str)
log.Println(str)
}
func Warnf(str string, args ...interface{}) {
msg := fmt.Sprintf(str, args...)
Logger.Warn(msg)
//log.Printf(msg+"\n")
log.Println(msg)
}
func Error(str string) {
Logger.Error(str)
//log.Println(str)
log.Println(str)
}
func Errorf(str string, args ...interface{}) {
msg := fmt.Sprintf(str, args...)
Logger.Error(msg)
//log.Printf(msg+"\n")
}
func Debug(str string) {
Logger.Debug(str)
//log.Println(str)
}
func Debugf(str string, args ...interface{}) {
msg := fmt.Sprintf(str, args...)
Logger.Debug(msg)
//log.Printf(msg+"\n")
log.Printf(msg + "\n")
}
func PrintUnicode(str []byte) {
......
package resUtils
import (
"fmt"
"github.com/aaronchen2k/deeptest/internal/pkg/lib/common"
"github.com/aaronchen2k/deeptest/res"
"io/ioutil"
"os"
)
func ReadRes(path string) (ret []byte, err error) {
isRelease := commonUtils.IsRelease()
if isRelease {
ret, err = res.Asset(path)
} else {
ret, err = ioutil.ReadFile(path)
}
dir, _ := os.Getwd()
fmt.Printf("isRelease=%t, path=%s, ret=%#v, dir=%s", isRelease, path, ret, dir)
return
}
......@@ -27,6 +27,7 @@ func Init() {
VIPER.SetConfigType("yaml")
configRes := filepath.Join("res", consts.AppServer+".yaml")
yamlDefault, _ := resUtils.ReadRes(configRes)
if err := VIPER.ReadConfig(bytes.NewBuffer(yamlDefault)); err != nil {
......
......@@ -60,7 +60,9 @@ type WebServer struct {
func Init() *WebServer {
serverConfig.Init()
serverLog.Init()
i118Utils.Init(serverConfig.CONFIG.System.Language, consts.AppServer)
langUtils.GetExtToNameMap()
app := iris.New()
......@@ -75,26 +77,6 @@ func Init() *WebServer {
close(idleConnClosed)
})
if serverConfig.CONFIG.System.Addr == "" { // 默认 8085
serverConfig.CONFIG.System.Addr = "127.0.0.1:8085"
}
if serverConfig.CONFIG.System.StaticPath == "" { // 默认 /static/upload
serverConfig.CONFIG.System.StaticPath = "/static/upload"
}
if serverConfig.CONFIG.System.StaticPrefix == "" { // 默认 /upload
serverConfig.CONFIG.System.StaticPrefix = "/upload"
}
if serverConfig.CONFIG.System.WebPath == "" { // 默认 /./dist
serverConfig.CONFIG.System.WebPath = "./dist"
}
if serverConfig.CONFIG.System.TimeFormat == "" { // 默认 80
serverConfig.CONFIG.System.TimeFormat = time.RFC3339
}
// init grpc
mvc.New(app)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册