Documentation ¶
Index ¶
- func ContextKeyValues(ctx context.Context) []models.KeyValue
- func ContextWith(ctx context.Context, opts ...ContextOption) context.Context
- func ContextWithKeyValues(ctx context.Context, add []models.KeyValue) context.Context
- func Debug(ctx context.Context, msg string, opts ...Option)
- func Error(ctx context.Context, err error, opts ...Option)
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Info(ctx context.Context, msg string, opts ...Option)
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SetCmdLoggerForTesting(t testing.TB, w io.Writer)
- func SetDefaultLoggerForTesting(t testing.TB, w io.Writer, opts ...Option)
- func SetLogger(l Logger)
- func SetLoggerForTesting(t testing.TB, l Logger)
- type CmdLogger
- type ContextOption
- type ElasticStringArray
- type Entry
- type ErrorObject
- type Interface
- type Jettison
- type Level
- type Logger
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextKeyValues ¶
ContextKeyValues returns the list of jettison key values options contained in the given context.
func ContextWith ¶
func ContextWith(ctx context.Context, opts ...ContextOption) context.Context
ContextWith returns a new context with the given jettison options appended to its key/value store. When a context containing jettison options is passed to Info or Error, the options are automatically applied to the resulting log.
func ContextWithKeyValues ¶
func Error ¶
Error writes a structured jettison log of the given error to the logger. If the error is not already a Jettison error, it is converted into one and then logged. Any jettison key/value pairs contained in the given context are included in the log. If err is nil, a new error is created.
func Fatal ¶
func Fatal(v ...interface{})
Fatal is equivalent to log.Print followed by a call to os.Exit(1). Deprecated: Use log.Info or log.Error instead and exit manually.
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf is equivalent to log.Printf followed by a call to os.Exit(1). Deprecated: Use log.Info or log.Error instead and exit manually.
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln is equivalent to log.Println followed by a call to os.Exit(1). Deprecated: Use log.Info or log.Error instead and exit manually.
func Info ¶
Info writes a structured jettison log to the logger. Any jettison key/value pairs contained in the given context are included in the log.
func Panic ¶
func Panic(v ...interface{})
Panic is equivalent to log.Print followed by a panic. Deprecated: Use log.Info or log.Error instead and panic manually.
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf is equivalent to log.Printf followed by a panic. Deprecated: Use log.Info or log.Error instead and panic manually.
func Panicln ¶
func Panicln(v ...interface{})
Panicln is equivalent to log.Println followed by a panic. Deprecated: Use log.Info or log.Error instead and panic manually.
func Print ¶
func Print(v ...interface{})
Print wraps a call to fmt.Sprint in a jettison log and writes it to the logger. Deprecated: Use log.Info or log.Error instead.
func Printf ¶
func Printf(format string, v ...interface{})
Printf wraps a call to fmt.Sprintf in a jettison log and writes it to the logger. Deprecated: Use log.Info or log.Error instead.
func Println ¶
func Println(v ...interface{})
Println wraps a call to fmt.Sprintln in a jettison log and writes it to the logger. Deprecated: Use log.Info or log.Error instead.
func SetLoggerForTesting ¶
Types ¶
type CmdLogger ¶
type CmdLogger struct {
// contains filtered or unexported fields
}
func NewCmdLogger ¶
NewCmdLogger returns a stdout human friendly command line logger.
type ContextOption ¶
ContextOption allows us to use the same type as an option for ContextWith as well as other jettison interfaces.
type ElasticStringArray ¶
type ElasticStringArray []struct { Content []string `json:">"` }
ElasticStringArray is a converted type that stops ElasticSearch from joining elements of the string slice with commas
func MakeElastic ¶
func MakeElastic(s []string) ElasticStringArray
func (ElasticStringArray) Content ¶
func (e ElasticStringArray) Content() []string
type Entry ¶
type Entry struct { Message string `json:"message"` Source string `json:"source"` Level Level `json:"level"` Timestamp time.Time `json:"timestamp"` Parameters []models.KeyValue `json:"parameters,omitempty"` ErrorCode *string `json:"error_code,omitempty"` ErrorObject *ErrorObject `json:"error_object,omitempty"` ErrorObjects []ErrorObject `json:"error_objects,omitempty"` }
type ErrorObject ¶
type Logger ¶
type Logger interface { // Log logs the given log and returns a string of what was written. Log(context.Context, Entry) string }
Logger does logging of log lines.
type Option ¶
type Option interface {
ApplyToLog(*Entry)
}