signals

package
v3.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ExitSignals are used to determine if an incoming os.Signal should cause termination.
	ExitSignals = map[os.Signal]bool{
		syscall.SIGHUP:  true,
		syscall.SIGINT:  true,
		syscall.SIGABRT: true,
		syscall.SIGILL:  true,
		syscall.SIGQUIT: true,
		syscall.SIGTERM: true,
		syscall.SIGSEGV: true,
		syscall.SIGTSTP: true,
	}
	// ExitChannel is for gracefully terminating the LogSignals() function.
	ExitChannel = make(chan bool, 1)
	// SignalChannel is for listening to OS signals.
	SignalChannel = make(chan os.Signal, 1)
	// Debug is defined globally for mocking logrus.Debug statements.
	Debug func(args ...interface{}) = logrus.Debug
)

Functions

func LogSignal

func LogSignal(sig os.Signal)

LogSignal prints a logging statements for the given signal, exiting only when observing an exit signal.

func LogSignals

func LogSignals()

LogSignals continuously prints logging statements for each signal it observes, exiting only when observing an exit signal.

func Stop

func Stop()

Stop gracefully terminates the concurrent signal logging. TODO: @tylerferrara Currently we don't gracefully exit, since the Auditor is designed to run indefinitely. In the future, we should enable graceful termination to allow this to be called from a Shutdown() function.

func Watch

func Watch()

Watch concurrently logs debug statements when encountering interrupt signals from the OS. This function relies on the os/signal package which may not capture SIGKILL and SIGSTOP.

Types

This section is empty.

Jump to

Keyboard shortcuts

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