Skip to content

hidevopsio/golog

Repository files navigation

✒️ golog

golog is a simple, fast and easy-to-use level-based logger written entirely in GoLang.

Output from win terminal

build status report card godocs github issues

🥇 Features

  • Focus on high performance and agile perspective of things
  • Easy API and a default package-level instance, i.e golog#Fatalf/Errorf/Warnf/Infof/Debugf
  • Fully compatible with the standard library
  • Thanks to the pio library it supports any type of structure, gives you the ability to Hijack and Handle or Intercept the on-going logs too
  • Set or even Add unlimited number of output targets, io.Writer
  • Scan from any io.Reader and log to the defined output target(s)
  • Levels such as fatal,error, warn, info, debug, or disable
  • Beautiful (customizable) colors for leveled logs, automatically omit colors when output does not support colors (i.e files)
  • Incredible high-performant, 3 times faster than your favourite logger
  • Never-Panics

Navigate through _examples and integrations to learn if that fair solution suits your needs.

🚀 Installation

The only requirement is the Go Programming Language*.

$ go get github.com/kataras/golog

golog is fairly built on top of the pio library, it has no more external dependencies.

package main

import (
    "github.com/kataras/golog"
)

func main() {
    // Default Output is `os.Stdout`,
    // but you can change it:
    // golog.SetOutput(os.Stderr)

    // Time Format defaults to: "2006/01/02 15:04"
    // you can change it to something else or disable it with:
    golog.SetTimeFormat("")

    // Level defaults to "info",
    // but you can change it:
    golog.SetLevel("debug")

    golog.Println("This is a raw message, no levels, no colors.")
    golog.Info("This is an info message, with colors (if the output is terminal)")
    golog.Warn("This is a warning message")
    golog.Error("This is an error message")
    golog.Debug("This is a debug message")
    golog.Fatal("Fatal will exit no matter what, but it will also print the log message if logger's Level is >=FatalLevel")
}

Examples

🔥 Benchmarks

test times ran (large is better) ns/op (small is better) B/op (small is better) allocs/op (small is better)
BenchmarkGologPrint 10000000 3749 ns/op 890 B/op 28 allocs/op
BenchmarkLogrusPrint   3000000 9609 ns/op 1611 B/op 64 allocs/op

Click here for details.

👥 Contributing

If you find that something is not working as expected please open an issue.

📦 Projects using golog

Package Author Description
iris Gerasimos Maropoulos The fastest web framework for Go in (THIS) Earth. HTTP/2 Ready-To-GO. Mobile Ready-To-GO.

Do not hesitate to put your package on this list via PR!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages