优化代码

This commit is contained in:
GoEdgeLab
2023-08-08 12:02:21 +08:00
parent 1ab328bb02
commit 72c390fba5
12 changed files with 26 additions and 19 deletions

View File

@@ -11,7 +11,7 @@ import (
"sync"
)
// 服务管理器
// ServiceManager 服务管理器
type ServiceManager struct {
Name string
Description string
@@ -39,7 +39,7 @@ func (this *ServiceManager) setup() {
this.onceLocker.Do(func() {
logFile := files.NewFile(Tea.Root + "/logs/service.log")
if logFile.Exists() {
logFile.Delete()
_ = logFile.Delete()
}
//logger
@@ -53,7 +53,7 @@ func (this *ServiceManager) setup() {
})
}
// 记录普通日志
// Log 记录普通日志
func (this *ServiceManager) Log(msg string) {
this.setup()
if this.logger == nil {
@@ -62,7 +62,7 @@ func (this *ServiceManager) Log(msg string) {
this.logger.Println("[info]" + msg)
}
// 记录错误日志
// LogError 记录错误日志
func (this *ServiceManager) LogError(msg string) {
this.setup()
if this.logger == nil {
@@ -71,7 +71,7 @@ func (this *ServiceManager) LogError(msg string) {
this.logger.Println("[error]" + msg)
}
// 关闭
// Close 关闭
func (this *ServiceManager) Close() error {
if this.fp != nil {
return this.fp.Close()
@@ -100,7 +100,7 @@ func (this *ServiceManager) resetRoot() {
Tea.SetTmpDir(Tea.Root + Tea.DS + "web" + Tea.DS + "tmp")
}
// 保持命令行窗口是打开的
// PauseWindow 保持命令行窗口是打开的
func (this *ServiceManager) PauseWindow() {
if runtime.GOOS != "windows" {
return