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:
17
ws/namespaces.go
Normal file
17
ws/namespaces.go
Normal 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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user