again
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-06-04 22:36:45 +02:00
parent 24cc151938
commit c0fd74f1e6

View File

@ -5,10 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os"
"time"
"github.com/rs/zerolog"
)
type LokiWriter struct {
@ -98,25 +95,3 @@ func (w *LokiWriter) Write(p []byte) (n int, err error) {
return len(p), nil
}
func main() {
lokiURL := "http://your-loki-url/loki/api/v1/push"
labels := map[string]string{
"app": "your_app_name",
// Add more labels as needed
}
lokiWriter := NewLokiWriter(lokiURL, labels)
consoleWriter := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339}
multiWriter := zerolog.MultiLevelWriter(consoleWriter, lokiWriter)
logger := zerolog.New(multiWriter).With().Timestamp().Logger()
// Configure the logger in the sublibrary
sublibrary.AddLogger(logger)
logger.Info().Msg("Main library log message")
sublibrary.SublibraryFunction()
}