Home

Awesome

logf

GoDoc Build Status Go Report Status Coverage Status

Faster-than-light, asynchronous, structured logger in Go with zero allocation count.

Example

The following example creates a new logf logger and logs a message.

package main

import (
    "runtime"

    "github.com/ssgreg/logf"
)

func main() {
    // The default channel writer writes to stdout using json encoder.
    writer, writerClose := logf.NewChannelWriter.Default()
    defer writerClose()

    logger := logf.NewLogger(logf.LevelInfo, writer)

    logger.Info("got cpu info", logf.Int("count", runtime.NumCPU()))
}

The output is the following:

{"level":"info","ts":"2018-11-03T09:49:56+03:00","msg":"got cpu info","count":8}

Benchmarks

TODO

TODOs

Benchmarks:

Encoder: