This library provides a hook for Logrus to send log entries to VictoriaLogs.
To install the library, use go get
:
go get github.com/quiknode-labs/victoria-logger
Here's a basic example to set up the VictoriaLogs hook:
import "github.com/quiknode-labs/victoria-logger"
func main() {
streams := make(map[string]interface{})
streams["service"] = "my-service"
streams["env"] = "production"
logger.Init(context.Background(), "http://my.victoria.logs", 2*time.Second, 100, 3, 1*time.Second, streams)
defer logger.Close()
logger.Log.Info("This is an example log")
}
You can configure the logger with various settings. Check the logger.go
file for more details and documentation.
If you're hosting this library in a private repository, you might encounter issues when trying to fetch it as a Go module due to Go's default module proxy and sum database not being able to access private repositories.
To resolve this, you can configure Go to bypass the proxy and checksum database for this module by setting the GOPRIVATE
environment variable:
export GOPRIVATE=github.com/quiknode-labs/*
This ensures that Go uses direct git access rather than the proxy and sum database when fetching the module.
Feel free to fork, modify, and submit pull requests. For major changes, please open an issue first to discuss your proposed changes.
This project is open-source and available under the MIT License.