Popularity
4.5
Growing
Activity
5.6
-
110
6
10
Programming language: Go
License: MIT License
Tags:
Logging
Latest version: v1.5.1
glg alternatives and similar packages
Based on the "Logging" category.
Alternatively, view glg alternatives based on common mentions on social networks and blogs.
-
spew
Implements a deep pretty printer for Go data structures to aid in debugging -
seelog
logging functionality with flexible dispatching, filtering, and formatting. -
logutils
Utilities for slightly better logging in Go (Golang) extending the standard logger. -
loggo
A logging library for Go. Doesn't use the built in go log standard library, but instead offers a replacement. -
rollingwriter
RollingWriter is an auto-rotate io.Writer implementation with multi policies to provide log file rotation. -
httpretty
Pretty-prints your regular HTTP requests on your terminal for debugging (similar to http.DumpRequest). -
ozzo-log
High performance logging supporting log severity, categorization, and filtering. Can send filtered log messages to various targets (e.g. console, network, mail). -
xlog
A structured logger for net/context aware HTTP handlers with flexible dispatching. -
sqldb-logger
A logger for Go SQL database driver without modify existing *sql.DB stdlib usage. -
logur
An opinionated logger interface and collection of logging best practices with adapters and integrations for well-known libraries (logrus, go-kit log, zap, zerolog, etc). -
gologger
Simple easy to use log lib for go, logs in Colored Cosole, Simple Console, File or Elasticsearch. -
stdlog
Stdlog is an object-oriented library providing leveled logging. It is very useful for cron jobs. -
mlog
A simple logging module for go, with 5 levels, an optional rotating logfile feature and stdout/stderr output. -
go-cronowriter
A simple writer that rotate log files automatically based on current date and time, like cronolog. -
slf
The Structured Logging Facade (SLF) for Go (like SLF4J but structured and for Go) -
Kiwi Logs&Context
Structured logger & context keeper for Go language -
gomol
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs -
go-rethinklogger
Automatically persists all the logs of your Go application inside RethinkDB. -
kemba
A tiny debug logging tool inspired by debug, great for CLI tools and applications. -
MrZ's go-logger
Easy to use, extendable and super fast logging package for Go -
gone/log
Fast, extendable, full-featured, std-lib source compatible log library.
Scout APM - Leading-edge performance monitoring starting at $39/month
Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
Sponsored
scoutapm.com
Do you think we are missing an alternative of glg or a related project?
Popular Comparisons
README
glg is simple golang logging library
Requirement
Go 1.11
Installation
go get github.com/kpango/glg
Example
package main
import (
"net/http"
"time"
"github.com/kpango/glg"
)
// NetWorkLogger sample network logger
type NetWorkLogger struct{}
func (n NetWorkLogger) Write(b []byte) (int, error) {
// http.Post("localhost:8080/log", "", bytes.NewReader(b))
http.Get("http://127.0.0.1:8080/log")
glg.Success("Requested")
glg.Infof("RawString is %s", glg.RawString(b))
return 1, nil
}
func main() {
// var errWriter io.Writer
// var customWriter io.Writer
infolog := glg.FileWriter("/tmp/info.log", 0666)
customTag := "FINE"
customErrTag := "CRIT"
errlog := glg.FileWriter("/tmp/error.log", 0666)
defer infolog.Close()
defer errlog.Close()
glg.Get().
SetMode(glg.BOTH). // default is STD
// DisableColor().
// SetMode(glg.NONE).
// SetMode(glg.WRITER).
// SetMode(glg.BOTH).
// InitWriter().
// AddWriter(customWriter).
// SetWriter(customWriter).
// AddLevelWriter(glg.LOG, customWriter).
// AddLevelWriter(glg.INFO, customWriter).
// AddLevelWriter(glg.WARN, customWriter).
// AddLevelWriter(glg.ERR, customWriter).
// SetLevelWriter(glg.LOG, customWriter).
// SetLevelWriter(glg.INFO, customWriter).
// SetLevelWriter(glg.WARN, customWriter).
// SetLevelWriter(glg.ERR, customWriter).
AddLevelWriter(glg.INFO, infolog). // add info log file destination
AddLevelWriter(glg.ERR, errlog). // add error log file destination
AddStdLevel(customTag, glg.STD, false). //user custom log level
AddErrLevel(customErrTag, glg.STD, true). // user custom error log level
SetLevelColor(glg.TagStringToLevel(customTag), glg.Cyan). // set color output to user custom level
SetLevelColor(glg.TagStringToLevel(customErrTag), glg.Red) // set color output to user custom level
glg.Info("info")
glg.Infof("%s : %s", "info", "formatted")
glg.Log("log")
glg.Logf("%s : %s", "info", "formatted")
glg.Debug("debug")
glg.Debugf("%s : %s", "info", "formatted")
glg.Warn("warn")
glg.Warnf("%s : %s", "info", "formatted")
glg.Error("error")
glg.Errorf("%s : %s", "info", "formatted")
glg.Success("ok")
glg.Successf("%s : %s", "info", "formatted")
glg.Fail("fail")
glg.Failf("%s : %s", "info", "formatted")
glg.Print("Print")
glg.Println("Println")
glg.Printf("%s : %s", "printf", "formatted")
glg.CustomLog(customTag, "custom logging")
glg.CustomLog(customErrTag, "custom error logging")
glg.Get().AddLevelWriter(glg.DEBG, NetWorkLogger{}) // add info log file destination
http.Handle("/glg", glg.HTTPLoggerFunc("glg sample", func(w http.ResponseWriter, r *http.Request) {
glg.New().
AddLevelWriter(glg.Info, NetWorkLogger{}).
AddLevelWriter(glg.Info, w).
Info("glg HTTP server logger sample")
}))
http.ListenAndServe("port", nil)
// fatal logging
glg.Fatalln("fatal")
}
Benchmarks
Contribution
- Fork it ( https://github.com/kpango/glg/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
Author
LICENSE
glg released under MIT license, refer LICENSE file.
*Note that all licence references and agreements mentioned in the glg README section above
are relevant to that project's source code only.