Skip to content
Structured key-value logger without breaking order of fields. 🔧
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Package provides to structured log both for displaying it sanely in the stderr logs as well as sending key-valued logs into any log storage such as ElasticSearch.

To setup basic stderr logging, use following snippet in your main.go:

import ""

// ...

stderr := lorg.NewLog()
    lorg.NewFormat("${time} ${level:[%s]:right:short} ${prefix}%s"),

if args["--debug"].(bool) {

log = cog.NewLogger(stderr)

// use like that
log.Infof(nil, "message to log: %d", 1)
log.Infof(karma.Describe("key", "value"), "message to log: %d", 1)

err := errors.New("some error")
    karma.Describe("context", "testing error").Reason(err),
    "message to log: %d",

To see more examples of how to use karma for structured logging and error reporting, consider looking at tests and examples.


Following package offers significant improvements above logrus and similar structured loggers:

  • Readable tree-like log entries in stderr, which makes easy to debug program, because log is more readable.
  • Allows to use context errors, that used to describe errors on all call-stack levels to ease finding problems and fixing them.
  • Sends logs to ES in key-value format like other structured loggers.
  • Does not change ordering of key-values in the context.


This project is licensed under the terms of the MIT license.

You can’t perform that action at this time.