log

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogMessage

type LogMessage struct {

	// list of key value pairs as a string to include in the message
	KeyValuePairs string `json:"keyValuePairs"`
	// the severity toggle for chosing the correct logger
	Severity OpaLogSeverity `json:"severity"`
	// the timestamp of the log generation
	Timestamp string `json:"timestamp"`
}

type Logger

type Logger interface {
	LogWithValues(OpaLogSeverity, ...interface{})
	Info(...interface{})
	Error(error)
	Plain(string)
}
var KLogger Logger = &LoggerStruct{}

type LoggerStruct

type LoggerStruct struct{}

func (*LoggerStruct) Error

func (l *LoggerStruct) Error(e error)

Error takes an error and logs it with the error logger

func (*LoggerStruct) Info

func (l *LoggerStruct) Info(keyValuePairs ...interface{})

Info takes a key value pair interfaace array and logs it with the info logger

func (*LoggerStruct) LogWithValues

func (l *LoggerStruct) LogWithValues(severity OpaLogSeverity, keyValuePairs ...interface{})

LogWithValues takes the severity logger key and the key value pair interface and logs to the user using the correct logging interface

func (*LoggerStruct) Plain

func (l *LoggerStruct) Plain(s string)

Plain takes a string and logs it without JSON to the screen

type OpaLogSeverity

type OpaLogSeverity string
const (
	// used for logging to STDOUT only
	InfoSeverity OpaLogSeverity = "info"
	// used for logging to STDOUT and STDERR together
	ErrorSeverity OpaLogSeverity = "error"
)

Jump to

Keyboard shortcuts

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