Popularity
1.4
Growing
Activity
0.0
Stable
15
2
1
Programming language: Go
License: MIT License
Tags:
Logging
Latest version: v0.1.0
glo alternatives and similar packages
Based on the "Logging" category.
Alternatively, view glo 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
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting. -
go-logger
Simple logger for Go programs. Allows custom formats for messages. -
rollingwriter
Rolling writer is an IO util for auto rolling write in go. -
httpretty
Package httpretty prints the HTTP requests you make with Go pretty on your terminal. -
loggo
A logging library for Go. Doesn't use the built in go log standard library, but instead offers a replacement. -
sqldb-logger
A logger for Go SQL database driver without modifying existing *sql.DB stdlib usage. -
ozzo-log
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets. -
gologger
Simple easy to use log lib for go, logs in Colored Cosole, Simple Console, File or Elasticsearch. -
noodlog
๐ Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content. -
mlog
A simple logging module for go, with a rotating file feature and console logging. -
slf
The Structured Logging Facade (SLF) for Go (like SLF4J but structured and for Go) -
Kiwi Logs&Context
Fast, structured, with filters and dynamic sinks. No levels. Logger & context keeper for Go language ๐ฅ It smell like a mushroom. -
gomol
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs -
kemba
A tiny debug logging tool. Ideal for CLI tools and command applications. Inspired by https://github.com/visionmedia/debug -
go-rethinklogger
Automatically persists all the logs of your Go application inside RethinkDB. -
MrZ's go-logger
:mag: Easy to use, extendable and super fast logging package for Go
Static code analysis for 29 languages.
Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
Promo
www.sonarqube.org
Do you think we are missing an alternative of glo or a related project?
Popular Comparisons
README
GLO
Logging library for Golang
Inspired by Monolog for PHP, severity levels are identical
Install
go get github.com/lajosbencz/glo
Severity levels
Debug = 100
Info = 200
Notice = 250
Warning = 300
Error = 400
Critical = 500
Alert = 550
Emergency = 600
Simple example
package main
import "github.com/lajosbencz/glo"
func main() {
// Info - Warning will go to os.Stdout
// Error - Emergency will go to os.Stderr
log := glo.NewStdFacility()
// goes to os.Stdout
log.Debug("Detailed debug line: %#v", map[string]string{"x": "foo", "y": "bar"})
// goes to os.Stderr
log.Error("Oooof!")
}
Output:
2019-01-22T15:16:08+01:00 [DEBUG] Detailed debug line [map[x:foo y:bar]]
2019-01-22T15:16:08+01:00 [ERROR] Oooof! []
Customized example
package main
import (
"bytes"
"fmt"
"os"
"strings"
"github.com/lajosbencz/glo"
)
func main() {
log := glo.NewFacility()
// write everything to a buffer
bfr := bytes.NewBufferString("")
handlerBfr := glo.NewHandler(bfr)
log.PushHandler(handlerBfr)
// write only errors and above using a short format
handlerStd := glo.NewHandler(os.Stdout)
formatter := glo.NewFormatter("{L}: {M}")
filter := glo.NewFilterLevel(glo.Error)
handlerStd.SetFormatter(formatter)
handlerStd.PushFilter(filter)
log.PushHandler(handlerStd)
fmt.Println("Log output:")
fmt.Println(strings.Repeat("=", 70))
log.Info("Only written to the buffer")
log.Alert("Written to both buffer and stdout")
fmt.Println("")
fmt.Println("Buffer contents:")
fmt.Println(strings.Repeat("=", 70))
fmt.Println(bfr.String())
}
Output:
Log output:
======================================================================
ALERT: Written to both buffer and stdout []
Buffer contents:
======================================================================
2019-01-22T15:14:16+01:00 [INFO] Only written to the buffer []
2019-01-22T15:14:16+01:00 [ALERT] Written to both buffer and stdout []
Custom filter
package main
import (
"os"
"regexp"
"github.com/lajosbencz/glo"
)
func main() {
handler := glo.NewHandler(os.Stdout)
filterEmptyLines := &filterRgx{regexp.MustCompile(`^.+$`)}
handler.PushFilter(filterEmptyLines)
log := glo.NewFacility()
log.PushHandler(handler)
log.Debug("", "format is empty, should be ignored")
log.Debug("only this should appear at the output")
}
type filterRgx struct {
rgx *regexp.Regexp
}
func (f *filterRgx) Check(level glo.Level, line string, params ...interface{}) bool {
return f.rgx.MatchString(line)
}
Output:
2019-01-22T15:30:23+01:00 [DEBUG] only this should appear at the output