mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-03 13:06:37 +08:00
优化代码
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user