signals

package
v0.0.0-...-04f2983 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

Signals package

The signals package contains common signal handling functions that are shared by the binaries built in this repository.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CrashOnError = false

CrashOnError causes a coredump to be produced when an internal error occurs or a fatal signal is received.

Functions

func Backtrace

func Backtrace()

Backtrace writes a multi-line backtrace to the logger.

func Die

func Die(dieCb DieCb)

Die causes a backtrace to be produced. If CrashOnError is set a coredump will be produced, else the program will exit.

func FatalSignal

func FatalSignal(sig syscall.Signal) bool

FatalSignal returns true if the specified signal should cause the program to abort.

func HandlePanic

func HandlePanic(dieCb DieCb)

HandlePanic writes a message to the logger and then calls Die().

func HandledSignals

func HandledSignals() []syscall.Signal

HandledSignals returns a list of signals the package can deal with.

func NonFatalSignal

func NonFatalSignal(sig syscall.Signal) bool

NonFatalSignal returns true if the specified signal should simply cause the program to Backtrace() but continue running.

func SetLogger

func SetLogger(logger *logrus.Entry)

SetLogger sets the custom logger to be used by this package. If not called, the package will create its own logger.

Types

type DieCb

type DieCb func()

DieCb is the callback function type that needs to be defined for every call into the Die() function. This callback will be run as the first function of the Die() implementation.

Jump to

Keyboard shortcuts

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