mirror of
https://github.com/taigrr/log-socket
synced 2026-03-20 16:02:28 -07:00
18 lines
419 B
Go
18 lines
419 B
Go
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,
|
|
})
|
|
}
|