-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.go
48 lines (42 loc) · 1.21 KB
/
logger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package grpc_glog
import (
"github.com/golang/protobuf/jsonpb"
"time"
)
var (
// Marshaller of Protobuf to JSON
Marshaller = &jsonpb.Marshaler{}
)
// LogParams is the structure any formatter will be handed when time to log comes
type LogParams struct {
//Service is the HTTP method given to the request.
Service string
// Method is the HTTP method given to the request.
Method string
// TimeStamp shows the time after the webserve returns a response.
TimeStamp time.Time
// StatusCode is HTTP response code.
StatusCode string
// Latency is how much time the webserve cost to process a certain request.
Latency time.Duration
// IP equals Context's IP method.
IP string
// Path is a path the client requests.
Path string
// ErrorMessage is set if error has occurred in processing the request.
ErrorMessage string
// isTerm shows whether does gin's output descriptor refers to a terminal.
isTerm bool
// BodySize is the size of the Response Body
BodySize int
// Keys are the keys set on the request's context.
Keys map[string]interface{}
RequestData string
RequestUserAgent string
RequestReferer string
RequestProto string
RequestId string
TraceId string
SpanId string
ResponseData string
}