log

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 11 Imported by: 51

README

log

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(logType string, data ...interface{})

func Error

func Error(logType string, data ...interface{})

func Info

func Info(logType string, data ...interface{})

func LogRequest

func LogRequest(app, node, clientIp, fromApp, fromNode, clientId, sessionId, requestId, host string, authLevel, priority int, method, path string, requestHeaders map[string]string, requestData map[string]interface{}, usedTime float32, responseCode int, responseHeaders map[string]string, responseDataLength uint, responseData interface{}, extraInfo map[string]interface{})

func MakeLogTime added in v0.0.3

func MakeLogTime(time time.Time) float64

func MakeUesdTime added in v0.0.3

func MakeUesdTime(startTime, endTime time.Time) float32

func ParseSpecialLog added in v0.0.5

func ParseSpecialLog(from *BaseLog, to interface{}) error

func SetLevel

func SetLevel(level LevelType)

func SetTruncations

func SetTruncations(truncations ...string)

func SetWriter

func SetWriter(writer func(string))

func Warning

func Warning(logType string, data ...interface{})

Types

type BaseLog added in v0.0.3

type BaseLog struct {
	LogType  string
	LogTime  time.Time
	LogLevel string
	Traces   string
	Extra    map[string]interface{}
}

func ParseBadLog added in v0.0.5

func ParseBadLog(line string) *BaseLog

func ParseBaseLog added in v0.0.5

func ParseBaseLog(line string) *BaseLog

type LevelType

type LevelType int
const DEBUG LevelType = 1
const ERROR LevelType = 4
const INFO LevelType = 2
const WARNING LevelType = 3

type Logger

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

func (*Logger) Debug

func (logger *Logger) Debug(logType string, data ...interface{})

func (*Logger) Error

func (logger *Logger) Error(logType string, data ...interface{})

func (*Logger) Info

func (logger *Logger) Info(logType string, data ...interface{})

func (*Logger) LogRequest

func (logger *Logger) LogRequest(app, node, clientIp, fromApp, fromNode, clientId, sessionId, requestId, host string, authLevel, priority int, method, path string, requestHeaders map[string]string, requestData map[string]interface{}, usedTime float32, responseCode int, responseHeaders map[string]string, responseDataLength uint, responseData interface{}, extraInfo map[string]interface{})

func (*Logger) SetLevel

func (logger *Logger) SetLevel(level LevelType)

func (*Logger) SetTruncations

func (logger *Logger) SetTruncations(truncations ...string)

func (*Logger) SetWriter

func (logger *Logger) SetWriter(writer func(string))

func (*Logger) Warning

func (logger *Logger) Warning(logType string, data ...interface{})

type RequestLog added in v0.0.3

type RequestLog struct {
	BaseLog
	App                string
	Node               string
	ClientIp           string
	FromApp            string
	FromNode           string
	ClientId           string
	SessionId          string
	RequestId          string
	Host               string
	AuthLevel          int
	Priority           int
	Method             string
	Path               string
	RequestHeaders     map[string]string
	RequestData        map[string]interface{}
	UsedTime           float32
	ResponseCode       int
	ResponseHeaders    map[string]string
	ResponseDataLength uint
	ResponseData       interface{}
}

Jump to

Keyboard shortcuts

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