daemon

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

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

func SetLogFunc(f func(format string, a ...interface{}))

设置日志记录函数

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL