Brijesh's Git Server — argus-demo @ 0463e833db032e9940eaa0f69a9b425a1f08df44

feat: use the new slog handler
Brijesh Wawdhane ops@brijesh.dev
Sat, 28 Dec 2024 15:24:55 +0530
commit

0463e833db032e9940eaa0f69a9b425a1f08df44

parent

dd547c6ec9ce38e3910cb17bc769866735804f14

1 files changed, 12 insertions(+), 14 deletions(-)

jump to
M main.gomain.go

@@ -1,26 +1,24 @@

package main -import "github.com/wbrijesh/argus_client" +import ( + "log/slog" + + "github.com/wbrijesh/argus_client" +) func main() { client := argus_client.NewClient( argus_client.ClientConfig{ - ApiKey: "argus_dSHLPT5hZfs3-7G7R8X8aO9WtMhaTtg52Nnn96RQf7s", + ApiKey: "argus_jW35MW2m-dNdtSbhFVSrudlSIpQCA99apo_2mRvdbjU", 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"}, - } + argusHandler := argus_client.NewArgusHandler(client) + logger := slog.New(argusHandler) - err := client.SendLogs(logs) - - if err != nil { - panic(err) - } + logger.Info("Info Log using slog handler") + logger.Error("Error Log using slog handler") + logger.Debug("Debug Log using slog handler") + logger.Warn("Warn Log using slog handler") }