Description
• go-rethinklogger persists and bundles all your logs from `stdio` and `stderr` to RethinkDB.
• Can be used to monitor logs and analytics of your GO application remotely.
• It works and is compatible with literally all types of loggers. The API is exceptionally simple and you just need to do normal logging,
it automatically reads from `stdio` and `stderr`, persists logs for later use and echoes the same back to their respective streams.
go-rethinklogger alternatives and similar packages
Based on the "Logging" category.
Alternatively, view go-rethinklogger alternatives based on common mentions on social networks and blogs.
-
spew
Implements a deep pretty printer for Go data structures to aid in debugging -
tail
Go package for reading from continously updated files (tail -f) -
seelog
Seelog is a native Go logging library that provides flexible asynchronous dispatching, filtering, and formatting. -
logxi
A 12-factor app logger built for performance and happy development -
Onelog
Dead simple, super fast, zero allocation logger for Golang -
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. -
logrusiowriter
io.Writer implementation using logrus logger -
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. -
logur
Logur is an opinionated collection of logging best practices -
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. -
journald
Go implementation of systemd Journal's native API for 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. -
logmatic
Colorized logger for Golang with dynamic log level configuration -
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
Build time-series-based applications quickly and at scale.
Do you think we are missing an alternative of go-rethinklogger or a related project?
README
go-rethinklogger
go-rethinklogger persists and bundles all your logs from stdio
and stderr
to RethinkDB.
• Can be used to monitor logs and analytics of your GO application remotely.
• It works and is compatible with literally all types of loggers. The API is exceptionally simple and you just need to do normal logging,
it automatically reads from stdio
and stderr
, persists logs for later use and echoes the same back to their respective streams.
Installation.
• Using Go.
go get github.com/MustansirZia/go-rethinklogger
• Using Glide.
glide get github.com/MustansirZia/go-rethinklogger
glide up
• Using go-vendor.
govendor fetch github.com/MustansirZia/go-rethinklogger
Usage.
// Start persisting logs. Call preferably from init.
// Start takes a rethinkDB address and the admin password
// as arguments. Don't worry though, admin user is only
// used to create the database and a user.
rethinklogger.Start("localhost:28015", "adminPassword")
fmt.Fprintln(os.Stdout, "Sample stdio log!")
fmt.Fprintln(os.Stderr, "Sample stderr log!")
...
...
// Query logs from anywhere in your application.
previousDay := time.Now().Add(0, 0, -1)
now := time.Now()
logs, err := rethinklogger.QueryLogs("localhost:28015", previousDay, now)
if err != nil {
fmt.Println(err.Error())
}
for _, log := range logs {
/*
log {
Log = "Sample stdio log!"
CreatedAtHuman = "17 Aug 17 15:04 +530"
CreatedAt = 1503162020
}
log {
Log = "Sample stderr log!"
CreatedAtHuman = "17 Aug 17 15:04 +530"
CreatedAt = 1503162020
}
*/
}
Sidenotes.
• This library is built over go-shipit which dispatches std logs to a io.Writer
interface. This library is basically a writer for shipit.
• To avoid our database from getting overwhelmed by logs, logs are first accumulated inside a buffer and then dispatched at an interval of 5 secs.
• Logging can also be started using StartWithBuffer
function which takes an additional buffer size argument. This is the minimum number of logs that must be accumulated inside the buffer before all the logs are dispatched to Rethink.
By default the value is 1
.
Inspiration.
=> go-loggly - https://github.com/segmentio/go-loggly => Winston for nodejs - https://github.com/winstonjs/winston
License.
See License.
*Note that all licence references and agreements mentioned in the go-rethinklogger README section above
are relevant to that project's source code only.