Popularity
0.8
Growing
Activity
2.6
Growing
8
2
0

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.

Programming language: Go
License: MIT License
Tags: Database     Logging     Monitoring     Structured Logging     Stderr     Stdout     RethinkDB    
Latest version: v1.0.3

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.

Do you think we are missing an alternative of go-rethinklogger or a related project?

Add another 'Logging' Package

README

go-rethinklogger

Documentation Go Report Card GitHub tag MIT Licence

go-rethinklogger persists and bundles all your logs from stdio and stderr to RethinkDB.

RethinkDB Logo

• 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.