Backend: Error Monitoring
Go
JS
Python
Backend: Logging
Fullstack Frameworks
Next.JS
Self Host & Local Dev
Menu
Golang App
Learn how to set up highlight.io Go log ingestion without a logging library.
1
Set up your frontend and backend highlight.io integration.
First, make sure you've followed the frontend getting started and backend getting started guides.
2
Call the Highlight logging SDK.
Use our SDK to configure logrus, and use it as normal.
package main
import (
"context"
"github.com/highlight/highlight/sdk/highlight-go"
"github.com/highlight/highlight/sdk/highlight-go/log"
"github.com/sirupsen/logrus"
)
func main() {
// setup the highlight SDK
highlight.SetProjectID("YOUR_PROJECT_ID")
highlight.Start()
defer highlight.Stop()
// setup highlight logrus hook
hlog.Init()
// if you don't want to get stdout / stderr output, add the following uncommented
// hlog.DisableOutput()
// if in a request, provide context to associate logs with frontend sessions
ctx := context.TODO()
// send logs
logrus.WithContext(ctx).WithField("hello", "world").Info("welcome to highlight.io")
// send logs with a string message severity
lvl, _ := logrus.ParseLevel("warn")
logrus.WithContext(ctx).Log(lvl, "whoa there")
}
3
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.