Documentation ¶
Index ¶
- Variables
- func DeferExitHandler(handler func())
- func Entry() *logrus.Entry
- func GetFatalErrorDetail() []byte
- func RegisterHook(hook logrus.Hook)
- func RegisterSecret(secret string)
- func SetErrorCategory(category ErrorCategory)
- func SetFatalErrorDetail(error []byte)
- func SetFormatter(logFormat string)
- func SetStepName(stepName string)
- func SetVerbose(verbose bool)
- func Writer() io.Writer
- type CollectorHook
- type ErrorCategory
- type FatalHook
- type Message
- type PiperLogFormatter
- type SentryHook
Constants ¶
This section is empty.
Variables ¶
var LibraryName string
var LibraryRepository string
LibraryRepository that is passed into with -ldflags
Functions ¶
func DeferExitHandler ¶
func DeferExitHandler(handler func())
DeferExitHandler registers a logrus exit handler to allow cleanup activities.
func GetFatalErrorDetail ¶
func GetFatalErrorDetail() []byte
GetFatalErrorDetail retrieves the error which is currently known to the execution of a step
func RegisterSecret ¶
func RegisterSecret(secret string)
RegisterSecret registers a value which should be masked in every log message
func SetErrorCategory ¶
func SetErrorCategory(category ErrorCategory)
SetErrorCategory sets the error category This can be used later by calling log.GetErrorCategory() In addition it will be used when exiting the program with log.FatalError(err, message)
func SetFatalErrorDetail ¶
func SetFatalErrorDetail(error []byte)
SetFatalErrorDetail sets the fatal error to be stored
func SetFormatter ¶
func SetFormatter(logFormat string)
SetFormatter specifies the log format to use for piper's output
func SetVerbose ¶
func SetVerbose(verbose bool)
SetVerbose sets the log level with respect to verbose flag.
Types ¶
type CollectorHook ¶
func (*CollectorHook) Fire ¶
func (f *CollectorHook) Fire(entry *logrus.Entry) error
Fire creates a new event from the logrus and stores it in the SplunkHook object
func (*CollectorHook) Levels ¶
func (f *CollectorHook) Levels() []logrus.Level
Levels returns the supported log level of the hook.
type ErrorCategory ¶
type ErrorCategory int
ErrorCategory defines the category of a pipeline error
const ( ErrorUndefined ErrorCategory = iota ErrorBuild ErrorCompliance ErrorConfiguration ErrorCustom ErrorInfrastructure ErrorService ErrorTest )
Error categories which allow categorizing failures
func ErrorCategoryByString ¶
func ErrorCategoryByString(category string) ErrorCategory
ErrorCategoryByString returns the error category based on the category text
func GetErrorCategory ¶
func GetErrorCategory() ErrorCategory
GetErrorCategory retrieves the error category which is currently known to the execution of a step
func (ErrorCategory) String ¶
func (e ErrorCategory) String() string
type FatalHook ¶
FatalHook provides a logrus hook which persists details about a fatal error into the file system. This is helpful in order to transfer the error details to an orchestrating CI/CD system and by that make it possible to provide better error messages to the user.
type PiperLogFormatter ¶
type PiperLogFormatter struct { logrus.TextFormatter // contains filtered or unexported fields }
PiperLogFormatter is the custom formatter of piper
type SentryHook ¶
type SentryHook struct { Hub *sentry.Hub Event *sentry.Event // contains filtered or unexported fields }
SentryHook provides a logrus hook which enables error logging to sentry platform. This is helpful in order to provide better monitoring and alerting on errors as well as the given error details can help to find the root cause of bugs.
func NewSentryHook ¶
func NewSentryHook(sentryDsn, correlationID string) SentryHook
NewSentryHook initializes sentry sdk with dsn and creates new hook
func (*SentryHook) Fire ¶
func (sentryHook *SentryHook) Fire(entry *logrus.Entry) error
Fire creates a new event from the error and sends it to sentry
func (*SentryHook) Levels ¶
func (sentryHook *SentryHook) Levels() []logrus.Level
Levels returns the supported log level of the hook.