No description or website provided.
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
gosteno-prettify
syslog
.gitignore
.travis.yml
LICENSE
README.md
codec.go
config.go
config_test.go
io_sink.go
io_sink_test.go
json_codec.go
json_codec_test.go
json_prettifier.go
json_prettifier_test.go
log_level.go
log_level_test.go
logger.go
logger_test.go
null_sink_test.go
perf_test.go
record.go
record_test.go
regexp.go
sink.go
steno.go
steno_test.go
syslog_sink.go
syslog_sink_test.go
testing_sink.go
testing_sink_test.go

README.md

Gosteno Build Status

Gosteno is a golang implementation of the steno log tool. The feature set of Gosteno is very similar with that of ruby steno.

Overview

Core concepts behind Gosteno includes codec, sink, level, tag.

codec

A codec encodes log entries to structural data, more specifically, JSON format data. Besides JSON codecs, Gosteno provides prettified codec which generates more human-readable data.

sink

Roughly speaking, a sink is the destination where you store your log data. It's an abstraction of the underlying data storage systems. Currently Gosteno supports two kinds of sinks, namely IOSink and SyslogSink. IOSink includes files and standard output while SyslogSink streams your log data to syslog daemons such as rsyslogd. You can register as many sinks as you want. Everytime you log information, it will be written to all the sinks you have registered.

level

Gosteno supports 9 levels(from low to high): all, debug2, debug1, debug, info, warn, error, fatal, off. You can change the level on the fly without respawning the process.

tag

In gosteno, tags are extended information that will be encoded together with other normal log information. You can add as many tags as you want. Tag makes the log information extensive.

Get Gosteno

go get -u github.com/cloudfoundry/gosteno

Getting started

Here is a short but complete program showing how to registering sinks, chosing codec, tagging the information.

package main

import (
    "github.com/cloudfoundry/gosteno"
    "os"
)

func main() {
    c := &gosteno.Config{
        Sinks: []gosteno.Sink{
            gosteno.NewFileSink("./a.log"),
            gosteno.NewIOSink(os.Stdout),
            gosteno.NewSyslogSink("foobar"),
        },
        Level:     gosteno.LOG_INFO,
        Codec:     gosteno.NewJsonCodec(),
        EnableLOC: true,
    }
    gosteno.Init(c)
    logger := gosteno.NewLogger("test")
    t := gosteno.NewTaggedLogger(logger, map[string]string{"foo": "bar", "hello": "world"})
    t.Info("Hello")
}

Supported platforms

Currently targeting modern flavors of darwin and linux.

License

Apache 2.0