1
0
mirror of https://github.com/taigrr/log-socket synced 2026-03-20 19:32:25 -07:00

enable namespaced logging

This commit is contained in:
2025-11-10 16:07:28 -05:00
parent 9c571ca955
commit f86c2dbf46
11 changed files with 932 additions and 54 deletions

17
ws/namespaces.go Normal file
View File

@@ -0,0 +1,17 @@
package ws
import (
"encoding/json"
"net/http"
logger "github.com/taigrr/log-socket/v2/log"
)
// NamespacesHandler returns a JSON list of all namespaces that have been used
func NamespacesHandler(w http.ResponseWriter, r *http.Request) {
namespaces := logger.GetNamespaces()
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
"namespaces": namespaces,
})
}