daemon

package
v1.64.45 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

README

Daemon 使用说明

package main

import (
	"github.com/aid297/aid/daemon"
)

func main() {
	consoleArg := false
	configArg := true

	if consoleArg || configArg {
		daemon.OnceDaemon().
			SetTitle("启动程序").             // 程序标题
			SetLog("logs", "deamon.log"). // 日志文件路径和文件名
			SetLogEnable(true).           // 是否记录日志
			Launch()                      // 通过守护进程启动
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon 守护进程服务提供者

func OnceDaemon added in v1.64.29

func OnceDaemon() *Daemon

OnceDaemon 获取单例

func (*Daemon) Launch

func (my *Daemon) Launch()

Launch 启动守护进程

func (*Daemon) SetLog added in v1.54.24

func (*Daemon) SetLog(dir, filename string) *Daemon

SetLog 设置日志

func (*Daemon) SetLogDir added in v1.54.24

func (*Daemon) SetLogDir(logDir string) *Daemon

SetLogDir 设置日志目录

func (*Daemon) SetLogEnable added in v1.54.24

func (*Daemon) SetLogEnable(enable bool) *Daemon

SetLogEnable 设置日志开关

func (*Daemon) SetLogFilename added in v1.54.24

func (*Daemon) SetLogFilename(logFilename string) *Daemon

SetLogFilename 设置日志文件名

func (*Daemon) SetTitle added in v1.54.24

func (*Daemon) SetTitle(title string) *Daemon

SetTitle 设置标题

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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