Skip to content

Latest commit

 

History

History
73 lines (51 loc) · 2.11 KB

README.md

File metadata and controls

73 lines (51 loc) · 2.11 KB

Glog

Glog glugs the log files in a concurrent and thread-safe way.

Simple and easy to implement interfaces to log fast and efficiently

Go CodeQL Go Report Card CodeFactor Maintained Quality Gate Status GoDoc


Features

  • Thread-safe logger
  • Log formatting support
  • Logging in unstructured or structured format (JSON)

Usage

go get github.com/ric-v/glog

simple logger to stdout

package main

import "github.com/ric-v/glog"

func main() {
    defer glog.Cleanup()

    // log the message to the default concurrent logger
    glog.Info("Hello World")
}

json logger to file

package main

import "github.com/ric-v/glog"

func main() {
    logger := glog.JSONGlogger("glogger.log")
    defer logger.Cleanup()

    // log the message to custom json logger
    logger.Info("", "Hello", "World")
}

Benchmarks

Benchmark Iterations Time Size Allocation
BenchmarkJSONGlog 266092 3853 ns/op 2185 B/op 25 allocs/op
BenchmarkUnstructureGlog_log 412342 3054 ns/o 984 B/op 13 allocs/op

Examples

visit examples here

Code.Share.Prosper