common

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFormatter = NewJSONFormater()

Functions

func Exists

func Exists(haystack map[string]interface{}, needle string) bool

Returns true if the key exists in the map

func ExpandNested

func ExpandNested(key string, value interface{}, dest map[string]interface{})

func GetDockerCID added in v1.3.0

func GetDockerCID() string

func GetLogrusCaller

func GetLogrusCaller() *callstack.FrameInfo

Returns the file, function and line number of the function that called logrus

func RequestToMap

func RequestToMap(req *http.Request) map[string]interface{}

Given a *http.Request return a map with detailed information about the request

func ToFields

func ToFields(items map[string]string) logrus.Fields

Convert a map to logrus fields

Types

type JSONFormater added in v1.3.0

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

func NewJSONFormater added in v1.3.0

func NewJSONFormater() *JSONFormater

func (*JSONFormater) Format added in v1.3.0

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

type LogRecord

type LogRecord struct {
	Context   map[string]interface{} `json:"context,omitempty"`
	Category  string                 `json:"category,omitempty"`
	AppName   string                 `json:"appname"`
	HostName  string                 `json:"hostname"`
	LogLevel  string                 `json:"logLevel"`
	FileName  string                 `json:"filename"`
	FuncName  string                 `json:"funcName"`
	LineNo    int                    `json:"lineno"`
	Message   string                 `json:"message"`
	Timestamp Number                 `json:"timestamp"`
	CID       string                 `json:"cid,omitempty"`
	PID       int                    `json:"pid,omitempty"`
	TID       string                 `json:"tid,omitempty"`
	ExcType   string                 `json:"excType,omitempty"`
	ExcText   string                 `json:"excText,omitempty"`
	ExcValue  string                 `json:"excValue,omitempty"`
}

func (*LogRecord) FromFields

func (r *LogRecord) FromFields(fields logrus.Fields)

func (LogRecord) MarshalEasyJSON

func (v LogRecord) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LogRecord) MarshalJSON

func (v LogRecord) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LogRecord) UnmarshalEasyJSON

func (v *LogRecord) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LogRecord) UnmarshalJSON

func (v *LogRecord) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Number

type Number float64

func (Number) MarshalJSON

func (n Number) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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