Categorygithub.com/ric-v/glog
repositorypackage
1.1.0
Repository: https://github.com/ric-v/glog.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

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

BenchmarkIterationsTimeSizeAllocation
BenchmarkJSONGlog2660923853 ns/op2185 B/op25 allocs/op
BenchmarkUnstructureGlog_log4123423054 ns/o984 B/op13 allocs/op

Examples

visit examples here

Code.Share.Prosper