Documentation
¶
Index ¶
- Constants
- func ContextWithLogWriter(ctx context.Context, w io.Writer) context.Context
- func ContextWithOutput(ctx context.Context, output OutputType) context.Context
- func DeprecationWarning(opts *DeprecationOptions)
- func HandleErr(err error)
- func LogWriterFromContext(ctx context.Context) io.Writer
- func PrintExitError(summary string, detail ...string)
- type BufferedWriter
- type DeprecationOptions
- type GroupedError
- type LogLine
- type MetaData
- type OutputType
Constants ¶
View Source
const OutputKey = "output"
View Source
const WriterKey = "log-writer"
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogWriter ¶
func ContextWithOutput ¶
func ContextWithOutput(ctx context.Context, output OutputType) context.Context
func DeprecationWarning ¶
func DeprecationWarning(opts *DeprecationOptions)
func LogWriterFromContext ¶
LogWriterFromContext returns the currently configured log writer for reuse in routine loggers
func PrintExitError ¶
Types ¶
type BufferedWriter ¶
BufferedWriter is a writer that buffers all writes until Flush is called. This is useful in go routines where we don't want the logs to be mixed up between routines
func NewBufferedWriter ¶
func NewBufferedWriter(w io.Writer, github bool, identifier string) *BufferedWriter
func (*BufferedWriter) Flush ¶
func (b *BufferedWriter) Flush() error
Flush writes all buffered data to the inner writer
type DeprecationOptions ¶
type GroupedError ¶
type GroupedError struct {
Errors []error
// contains filtered or unexported fields
}
func NewGroupedError ¶
func NewGroupedError(msg string, errors []error) *GroupedError
func (*GroupedError) Error ¶
func (b *GroupedError) Error() string
type LogLine ¶
type LogLine struct {
Level string `mapstructure:"@level"`
Message string `mapstructure:"@message"`
Module string `mapstructure:"@module"`
Timestamp string `mapstructure:"@timestamp"`
Remainder map[string]interface{} `mapstructure:",remain"`
}
type MetaData ¶
func GetVersionMetadata ¶
func GetVersionMetadata() *MetaData
type OutputType ¶
type OutputType string
const ( OutputTypeConsole OutputType = "console" OutputTypeJSON OutputType = "json" )
func OutputFromContext ¶
func OutputFromContext(ctx context.Context) OutputType
OutputFromContext returns the output type from the context. If no output type is set console is returned
Click to show internal directories.
Click to hide internal directories.