logo alternatives and similar packages
Based on the "Logging" category.
Alternatively, view logo 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. -
sqldb-logger
A logger for Go SQL database driver without modifying existing *sql.DB stdlib usage. -
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. -
ozzo-log
A Go (golang) package providing high-performance asynchronous logging, message filtering by severity and category, and multiple message targets. -
logex
An golang log lib, supports tracking and level, wrap by standard log lib -
noodlog
๐ Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content. -
gologger
Simple easy to use log lib for go, logs in Colored Cosole, Simple Console, File or Elasticsearch. -
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. -
slog
The reference implementation of the Structured Logging Facade (SLF) for Go -
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 -
MrZ's go-logger
:mag: Easy to use, extendable and super fast logging package for Go
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of logo or a related project?
Popular Comparisons
README
Logo
A simple logging library for golang.
[banner](./banner.png)
I wanted to have a logger that is easy configurable with various io.Writers
and a simple active and color on / off switch, so I created it.
Explanation
A Logger
object can hold multiple Receivers
. Every Receiver
holds an io.Writer
object (f.e. os.File
, os.Stderr
), a Level
which is minimal the log level that is logged, a boolean Active
which says if the Receiver
should log or not, and a boolean Color
which prints output colored if turned on. Every Receiver
has also its own log format.
Initilization
First you have to install the package.
go get -u github.com/mbndr/logo
After that you can import it.
import "github.com/mbndr/logo"
Simple
It's possible to create a simple logger with a io.Writer
, the log level and a color boolean as parameter.
// Create a simple cli logger with activated colors which logs everything
log := logo.NewSimpleLogger(os.Stderr, logo.DEBUG, "prefix ", true)
Advanced
You can create multiple Receivers
and add it to a new Logger
.
// Receiver for the terminal which logs everything
cliRec := logo.NewReceiver(os.Stderr, "prefix ")
cliRec.Color = true
cliRec.Level = logo.DEBUG
// Helper function to get a os.File with the correct options
logFile, _ := logo.Open("./example/logo.log")
// Receiver for the log file
// This will log with level INFO (default) and have no colors activated
// Also the log format is simpler (f.e. ERRO: Message)
fileRec := logo.NewReceiver(logFile, "prefix ")
fileRec.Format = "%s: %s"
// Create the logger
log := logo.NewLogger(cliRec, fileRec)
Usage
If you created you logo.Logger
object, there are a few methods you can use to log.
// Methods which write like log.Println()
log.Debug("First debug", " and another string to log")
log.Info("Information")
log.Warn("Warning", " message")
log.Error("Error message")
log.Fatal("Fatal error", " because of something")
// Methods which write like log.Printf()
log.Debugf("Debug value %d", 16)
log.Infof("Listening on port %d", 8080)
log.Warnf("Invalid user %s", user.Name)
log.Errorf("Couldn't load config file: %s", path)
log.Fatalf("Fatal error: %s", err.Error())
// Disable the logger
log.Active = false
Tests
There are a few unit tests written for this library. To run them cd
into the project directory and run this.
go test -v
*Note that all licence references and agreements mentioned in the logo README section above
are relevant to that project's source code only.