Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.

Commit a62605a

Browse files
Merge pull request #15 from goinsane/develop
v1.0.2
2 parents 6ba197b + b5464fe commit a62605a

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

gelfoutput/gelfoutput.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (g *GelfOutput) Log(log *xlog.Log) {
8383
TimeUnix: float64(log.Time.UnixNano()) / float64(time.Second),
8484
Level: level,
8585
Facility: g.opts.Facility,
86-
Extra: make(map[string]interface{}),
86+
Extra: make(map[string]interface{}, 128+2*len(log.Fields)),
8787
}
8888
msg.Extra["severity"] = fmt.Sprintf("%s", log.Severity)
8989
msg.Extra["verbosity"] = int(log.Verbosity)
@@ -102,7 +102,8 @@ func (g *GelfOutput) Log(log *xlog.Log) {
102102
}
103103
for i := range log.Fields {
104104
field := &log.Fields[i]
105-
msg.Extra[fmt.Sprintf("%10.0d_%s", i, field.Key)] = field.Value
105+
msg.Extra[fmt.Sprintf("%3.3d_%s", i, field.Key)] = field.Value
106+
msg.Extra[fmt.Sprintf("_%s", field.Key)] = field.Value
106107
}
107108
g.writeMessage(msg)
108109
}

grpclogger/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/vendor
2+
/target
3+
4+
/LOCALNOTES

grpclogger/go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/goinsane/xlog/grpclogger
2+
3+
go 1.13
4+
5+
replace github.com/goinsane/xlog => ../
6+
7+
require (
8+
github.com/goinsane/xlog v0.0.0-00010101000000-000000000000
9+
)

grpclogger/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/goinsane/erf v1.0.3 h1:1ufPoJI5KKxQTR1HM4JVxgfzhbO8jiM1XA8mU/pVovc=
2+
github.com/goinsane/erf v1.0.3/go.mod h1:KIGOu4SVAUGC5gHe3Q/uCswZN40wwPFJ9MS924nA/AI=

grpclogger/grpclogger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ type GrpcLogger struct {
88
*xlog.Logger
99
}
1010

11-
func (g *GrpcLogger) V(l int) bool {
12-
return g.Logger.V(xlog.Verbose(l)) != nil
11+
func (g *GrpcLogger) V(v int) bool {
12+
return g.Logger.V(xlog.Verbose(v)) != nil
1313
}

xlog_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func ExampleWithTime() {
162162
// 2010/11/12 13:14:15 INFO - this is info log, verbosity 0.
163163
}
164164

165-
func ExampleLogger_test1() {
165+
func ExampleLogger() {
166166
logger := xlog.New(xlog.NewTextOutput(os.Stdout), xlog.SeverityInfo, 2)
167167
logger.SetFlags(xlog.FlagSeverity)
168168

0 commit comments

Comments
 (0)