Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StopDaemon ¶
StopDaemon send term signal to a daemonized process and reports the status.
Types ¶
type Info ¶
type Info struct {
// Server's hostname.
Host string `json:"host"`
// Server's operating system.
OS string `json:"os"`
// Server's architecture.
Arch string `json:"arch"`
// Number of server's CPUs
NumCPU int `json:"cpu-count"`
// Version of Go that executable was build with.
GoVersion string `json:"go-version"`
// Bytes allocated and not yet freed.
Alloc marshal.Bytes `json:"mem-used"`
// Bytes allocated and not yet freed.
AllocBytes uint64 `json:"mem-used-bytes"`
// Bytes allocated (even if freed).
TotalAlloc marshal.Bytes `json:"mem-allocated"`
// Bytes allocated (even if freed).
TotalAllocBytes uint64 `json:"mem-allocated-bytes"`
// Bytes obtained from system.
Sys marshal.Bytes `json:"mem-sys"`
// Bytes obtained from system.
SysBytes uint64 `json:"mem-sys-bytes"`
// Number of pointer lookups.
Lookups uint64 `json:"lookups"`
// Number of mallocs.
Mallocs uint64 `json:"mallocs"`
// Number of frees.
Frees uint64 `json:"mem-frees"`
// Bytes allocated and not yet freed (same as Alloc above).
HeapAlloc marshal.Bytes `json:"heap-used"`
// Bytes allocated and not yet freed (same as Alloc above).
HeapAllocBytes uint64 `json:"heap-used-bytes"`
// Bytes obtained from system.
HeapSys marshal.Bytes `json:"heap-sys"`
// Bytes obtained from system.
HeapSysBytes uint64 `json:"heap-sys-bytes"`
// Bytes in idle spans.
HeapIdle marshal.Bytes `json:"heap-idle"`
// Bytes in idle spans.
HeapIdleBytes uint64 `json:"heap-idle-bytes"`
// Bytes in non-idle span.
HeapInuse marshal.Bytes `json:"heap-inuse"`
// Bytes in non-idle span.
HeapInuseBytes uint64 `json:"heap-inuse-bytes"`
// Bytes released to the OS.
HeapReleased marshal.Bytes `json:"heap-released"`
// Bytes released to the OS.
HeapReleasedBytes uint64 `json:"heap-released-bytes"`
// Total number of allocated objects.
HeapObjects uint64 `json:"heap-objects"`
// Pprof stack counts
StackCount map[string]int `json:"stack-count"`
}
Info represents selected data provided by memstats and pprof.
type Options ¶
type Options struct {
// Working directory of a service after daemonizing.
HomeDir string
// Directory for log files. If it is not set, logging will be configured
// to print messages to stderr.
LogDir string
// Log files mode.
LogFileMode os.FileMode
// Log directories mode.
LogDirectoryMode os.FileMode
// LogLevel is the lowest level of log messages that will be logged.
LogLevel logging.Level
// Syslog facility for syslog messages. If it is not set, no logging to
// syslog will be done.
SyslogFacility logging.SyslogFacility
// Syslog tag for sysylog messages.
SyslogTag string
// Syslog named network.
SyslogNetwork string
// Syslog network address.
SyslogAddress string
// AccessLogLevel is the lowest level of HTTP access log messages that will
// be logged.
AccessLogLevel logging.Level
// Syslog facility for syslog messages of HTTP requests. If it is not set,
// no logging to syslog will be done.
AccessSyslogFacility logging.SyslogFacility
// Syslog tag for sysylog messages of HTTP requests.
AccessSyslogTag string
// PackageAccessLogLevel is the lowest level of HTTP access log messages
// that will be logged for package resolutions.
PackageAccessLogLevel logging.Level
// Syslog facility for syslog messages of package resolution requests.
// If it is not set, no logging to syslog will be done.
PackageAccessSyslogFacility logging.SyslogFacility
// Syslog tag for sysylog messages of package resolution requests.
PackageAccessSyslogTag string
// Is logging of audit messages completely disabled.
AuditLogDisabled bool
// Syslog facility for syslog audit messages. If it is not set,
// no logging to syslog will be done.
AuditSyslogFacility logging.SyslogFacility
// Syslog tag for sysylog audit messages.
AuditSyslogTag string
// If LogDir is set, but there is need to force logging to stderr,
// ForceLogToStderr should be set to true.
ForceLogToStderr bool
// File name of a PID file.
PidFileName string
// Mode of a PID file. Default 644.
PidFileMode os.FileMode
// File name in which to redirect stdout and stderr of a daemonized process.
// If it is not set, /dev/null will be used.
DaemonLogFileName string
// Mode of a daemon log file. Default 644.
DaemonLogFileMode os.FileMode
}
Options contain optional parameters for Service.
type Service ¶
type Service struct {
// A list of non-blocking or short-lived functions to be executed on
// Service.Start.
Functions []func() error
// Instance of resenje.org/daemon.Daemon.
Daemon *daemon.Daemon
// contains filtered or unexported fields
}
Service provides common functionalities of a system service, like setting a working directory, logging, putting process in the background aka daemonizing and starting arbitrary functions that provide core logic.
func NewService ¶
NewService creates a new instance of Service, based on provided Options.
Click to show internal directories.
Click to hide internal directories.