Skip to content
/ logf Public

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

License

Notifications You must be signed in to change notification settings

ssgreg/logf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • benchmarks descriptions
  • non-parallel execution explanation
  • scenario decomposition
  • use zerolog object and array marshaller
  • add checked logging for normal (not disabled) cases

Encoder:

  • move to clone
  • use EscapeString instead

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages