Skip to content

Songmu/go-ltsv

Repository files navigation

go-ltsv

Test Status Coverage Status MIT License PkgGoDev

LTSV library to map ltsv to struct.

Synopsis

import (
	"net"

	"github.com/Songmu/go-ltsv"
)

type log struct {
	Host    net.IP
	Req     string
	Status  int
	Size    int
	UA      string
	ReqTime float64
	AppTime *float64
	VHost   string
}

func main() {
	ltsvLog := "time:2016-07-13T00:00:04+09:00\t" +
		"host:192.0.2.1\t" +
		"req:POST /api/v0/tsdb HTTP/1.1\t" +
		"status:200\t" +
		"size:36\t" +
		"ua:ua:mackerel-agent/0.31.2 (Revision 775fad2)\t" +
		"reqtime:0.087\t" +
		"vhost:mackerel.io"
	l := &log{}
	ltsv.Unmarshal([]byte(ltsvLog), l)
	...
}

Description

LTSV parser and encoder for Go with reflection

Installation

% go get github.com/Songmu/go-ltsv

Author

Songmu

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •