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
A Go package striving to emulate the features of the BSD tail program. -
seelog
logging functionality with flexible dispatching, filtering, and formatting. -
logutils
Utilities for slightly better logging in Go (Golang) extending the standard logger. -
Onelog
Dead simple, super fast, zero allocation and modular logger for Golang -
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. -
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). -
logex
An golang log lib, supports tracking and level, wrap by standard log lib -
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. -
distillog
distilled levelled logging (think of it as stdlib + log levels). -
slf
The Structured Logging Facade (SLF) for Go (like SLF4J but structured and for Go) -
journald
Go implementation of systemd Journal's native API for logging. -
Kiwi Logs&Context
Structured logger & context keeper for Go language -
slog
The reference implementation of the Structured Logging Facade (SLF) for Go -
logmatic
Colorized logger for Golang with dynamic log level configuration. -
gomol
Gomol is a library for structured, multiple-output logging for Go with extensible logging outputs -
glo
PHP Monolog inspired logging facility with identical severity levels. -
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
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.