batman: send logs using client library
Brijesh Wawdhane ops@brijesh.dev
Fri, 27 Dec 2024 21:18:49 +0530
A
go.mod
@@ -0,0 +1,12 @@
+module argus-demo + +go 1.23.3 + +replace github.com/wbrijesh/argus_client => /Users/brijesh/projects/ongoing/argus/argus-client + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/twitchtv/twirp v8.1.3+incompatible // indirect + github.com/wbrijesh/argus_client v0.0.0-00010101000000-000000000000 // indirect + google.golang.org/protobuf v1.36.1 // indirect +)
A
go.sum
@@ -0,0 +1,6 @@
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/twitchtv/twirp v8.1.3+incompatible h1:+F4TdErPgSUbMZMwp13Q/KgDVuI7HJXP61mNV3/7iuU= +github.com/twitchtv/twirp v8.1.3+incompatible/go.mod h1:RRJoFSAmTEh2weEqWtpPE3vFK5YBhA6bqp2l1kfCC5A= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
A
main.go
@@ -0,0 +1,26 @@
+package main + +import "github.com/wbrijesh/argus_client" + +func main() { + client := argus_client.NewClient( + argus_client.ClientConfig{ + ApiKey: "argus_dSHLPT5hZfs3-7G7R8X8aO9WtMhaTtg52Nnn96RQf7s", + BaseUrl: "http://localhost:8080", + }, + ) + + logs := []argus_client.LogEntry{ + {Level: argus_client.LevelInfo, Message: "From Demo App: This is an info message"}, + {Level: argus_client.LevelError, Message: "From Demo App: This is an error message"}, + {Level: argus_client.LevelDebug, Message: "From Demo App: This is a debug message"}, + {Level: argus_client.LevelWarn, Message: "From Demo App: This is a warning message"}, + {Level: argus_client.LevelFatal, Message: "From Demo App: This is a fatal message"}, + } + + err := client.SendLogs(logs) + + if err != nil { + panic(err) + } +}