Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

OliverSchlueter/sloki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sloki

This project is now integrated into github.com/oliverschlueter/goutils

A slog handler (for GoLang) which sends logs to Loki.

You can find a docker-compose file to run Loki and Grafana in the loki_docker directory. There is also an example dashboard for Grafana.

Installation

go get github.com/OliverSchlueter/sloki

Usage

package main

import (
	"github.com/OliverSchlueter/sloki/sloki"
	"log/slog"
)

func main() {
	logger := sloki.NewService(sloki.Configuration{
		URL:          "http://localhost:3100/loki/api/v1/push",
		Service:      "my-service",
		ConsoleLevel: slog.LevelDebug,
		LokiLevel:    slog.LevelInfo,
	})
	slog.SetDefault(slog.New(logger))
}

About

A slog handler which sends logs to Loki

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages