Skip to content

Install

Patrol is one Go package. Add it to your module:

Terminal window
go get github.com/kataras/patrol@latest

Go 1.27 or newer, which is what the library’s own go.mod declares. It builds on recent standard library work: encoding/json/v2 for the wire format, the uuid package for event ids, and errors.AsType for the typed error checks. An older toolchain will not compile it.

There are no sub-packages. Every constructor, option struct and flusher is under patrol. This much builds and runs, and delivers nowhere, because a Producer with no flushers has nowhere to deliver to:

package main
import (
"context"
"log"
"github.com/kataras/patrol"
)
func main() {
ctx := context.Background()
producer := patrol.NewProducer(patrol.ProducerOptions{ProjectName: "checkout-api"})
defer producer.Close(ctx)
if err := producer.SendEvent(ctx, patrol.NewEvent(patrol.Info).WithMessage("service started")); err != nil {
log.Fatal(err)
}
}

Add a flusher as the second argument to NewProducer and the same event reaches Slack, a database or a remote Server.

The module requires a client library for each integration it ships: slack-go/slack, bwmarrin/discordgo, twilio/twilio-go, kataras/httpclient and kataras/basicauth. Go links only what your binary reaches, so a service that uses the HTTP client and nothing else does not carry the Slack or Discord code into its binary.

The library opens no listening socket of its own, reads and writes no file, and sends nothing anywhere you did not configure. There is no telemetry and no update check.

Terminal window
go list -m github.com/kataras/patrol

The changelog is generated from the library’s own HISTORY.md, so what it lists is what shipped. v0.0.6 changed several exported names; if you are coming from v0.0.5 read its “Breaking changes” section before the upgrade.

Next: send your first event.