Skip to content

bakins/twirpzap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc

twirp zap logger

Logger for twirp servers using zap

Usage

Install locally: go get -u github.com/bakins/twirpzap

Create server hooks:

import (
    "github.com/twitchtv/twirp/example"
    "go.uber.org/zap"
    "github.com/bakins/twirpzap"
)

func main() {
    logger, _ := zap.NewProduction()
    defer logger.Sync() 

    server := example.NewHaberdasherServer(&testHaberdasher{}, twirpzap.ServerHooks(logger))	
}

Log lines will look like:

{"level":"info","ts":1557966347.879602,"caller":"twirp-zap-logger/logger.go:62","msg":"response sent","twirp.package":"twitch.twirp.example","twirp.service":"Haberdasher","twirp.method":"MakeHat","twirp.status":"200","duration":0.000169998}

See also ./example/server.go

LICENSE

See LICENSE

About

Structured logs for twirp servers using zap

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages