log

package
v3.0.15 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 9 Imported by: 414

Documentation

Index

Constants

View Source
const (
	// FormatLayoutJSON uses JSON layout
	FormatLayoutJSON FormatLayoutType = "json"

	// FormatLayoutText uses classic colorful Jenkins X layout
	FormatLayoutText FormatLayoutType = "text"

	// FormatLayoutStackdriver uses a custom formatter for stackdriver
	FormatLayoutStackdriver FormatLayoutType = "stackdriver"

	JxLogFormat = "JX_LOG_FORMAT"
	JxLogFile   = "JX_LOG_FILE"
	JxLogLevel  = "JX_LOG_LEVEL"
)

Variables

This section is empty.

Functions

func Append

func Append(f io.Writer, data []byte) error

func CaptureOutput

func CaptureOutput(f func()) string

CaptureOutput calls the specified function capturing and returning all logged messages.

func GetLevel

func GetLevel() string

GetLevel gets the current log level

func GetLevels

func GetLevels() []string

GetLevels returns the list of valid log levels

func Logger

func Logger() *logrus.Entry

Logger obtains the logger for use in the jx codebase This is the only way you should obtain a logger

func SetLevel

func SetLevel(s string) error

SetLevel sets the logging level

func SetOutput

func SetOutput(out io.Writer)

SetOutput sets the outputs for the default logger.

Types

type FormatLayoutType

type FormatLayoutType string

FormatLayoutType the layout kind

type Hook

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

Hook is a logrus hook for splunk

func NewHook

func NewHook(path string, levels []logrus.Level) *Hook

func (*Hook) Fire

func (h *Hook) Fire(entry *logrus.Entry) error

func (*Hook) Levels

func (h *Hook) Levels() []logrus.Level

Levels Required for logrus hook implementation

type JenkinsXTextFormat

type JenkinsXTextFormat struct {
	ShowInfoLevel   bool
	ShowTimestamp   bool
	TimestampFormat string
}

JenkinsXTextFormat lets use a custom text format

func NewJenkinsXTextFormat

func NewJenkinsXTextFormat() *JenkinsXTextFormat

NewJenkinsXTextFormat creates the default Jenkins X text formatter

func (*JenkinsXTextFormat) Format

func (f *JenkinsXTextFormat) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log statement

Jump to

Keyboard shortcuts

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