Skip to content
text transformer to put timestamps. It is very useful for logging.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_tools
cmd/timestamp
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
Makefile
README.md
format_test.go
stamper.go
stamper_test.go
version.go

README.md

timestamper

Build Status Coverage Status MIT License GoDoc

text transformer to put timestamps. It is very useful for logging.

Description

The text transformer to put timestamps. The timestamper implements golang.org/x/text/transform.Transform interface.

Synopsis

Easy Usage

var s transform.Transformer = timestamper.New()
var w io.WriteCloser = transform.NewWriter(os.Stdout, s)
fmt.Fprint(w, "Hello\nWorld!")
// Output:
// 2019-02-11T01:14:54.093021+09:00 Hello
// 2019-02-11T01:14:54.093151+09:00 World!

Functional Option

s1 := timestamper.New(timestamper.UTC()) // use UTC timestamp
s2 := timestamper.New(timestamper.Layout("06-01-02 15:04:05 ")) // specify custom layout

Installation

% go get github.com/Songmu/timestamper

Author

Songmu

You can’t perform that action at this time.