MCPcopy Index your code
hub / github.com/0xUnixIO/pulse / handleNodeLogs

Method handleNodeLogs

internal/serverapi/api.go:451–469  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, nodeID string)

Source from the content-addressed store, hash-verified

449}
450
451func (a *API) handleNodeLogs(w http.ResponseWriter, r *http.Request, nodeID string) {
452 if r.Method != http.MethodGet {
453 writeMethodNotAllowed(w, http.MethodGet)
454 return
455 }
456 client, err := a.clientFor(nodeID)
457 if err != nil {
458 writeNodeError(w, err)
459 return
460 }
461 ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
462 defer cancel()
463 out, err := client.Logs(ctx)
464 if err != nil {
465 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
466 return
467 }
468 writeJSON(w, http.StatusOK, out)
469}
470
471func (a *API) handleNodeLogsStream(w http.ResponseWriter, r *http.Request, nodeID string) {
472 if r.Method != http.MethodGet {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 6

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
writeNodeErrorFunction · 0.85
writeJSONFunction · 0.70
LogsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected