common

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 GetLogrusCaller

func GetLogrusCaller() *stack.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 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