Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(serviceName string, serviceDescription string, dependencies []string, onStart func(), onShutdown func() error)
启动服务,一般在 main() 函数中执行 serviceName 服务名称 serviceDescription 服务介绍 dependencies 服务依赖项,一般为 nil onStart 启动服务函数,如果函数内有阻塞的代码(比如监听服务器),需要自己创建 goroutine onShutdown 关闭服务函数,用于接收到关闭信号后执行相应的清理,当函数结束时进程将退出
func SetLogFunc ¶ added in v1.0.15
func SetLogFunc(f func(format string, a ...interface{}))
设置日志记录函数
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.