MCPcopy Create free account
hub / github.com/dagger/dagger / debug

Method debug

cmd/dagger/shell_state.go:185–215  ·  view source on GitHub ↗
(ctx context.Context, dump bool)

Source from the content-addressed store, hash-verified

183}
184
185func (s *ShellStateStore) debug(ctx context.Context, dump bool) {
186 slog := slog.SpanLogger(ctx, InstrumentationLibrary)
187
188 // Dumping the full states in the store can be useful to debug issues related
189 // to managing state but it can generate a bunch of hard to read output so
190 // tailor to verbosity level.
191
192 if verbose < 2 {
193 s.mu.RLock()
194 size := len(s.data)
195 s.mu.RUnlock()
196 slog.Debug("state store", "items", size)
197 return
198 }
199
200 if !dump || verbose < 4 {
201 s.mu.RLock()
202 keys := slices.Collect(maps.Keys(s.data))
203 s.mu.RUnlock()
204 slog.Debug("state store", "items", keys)
205 return
206 }
207
208 s.mu.RLock()
209 states := slices.Collect(maps.Values(s.data))
210 s.mu.RUnlock()
211
212 for _, st := range states {
213 slog.Debug("state store dump", spreadDebugArgs(&st)...)
214 }
215}
216
217func spreadDebugArgs(args ...any) []any {
218 a := []any{}

Callers 1

HandleMethod · 0.45

Calls 5

SpanLoggerFunction · 0.92
DebugFunction · 0.92
spreadDebugArgsFunction · 0.85
KeysMethod · 0.65
ValuesMethod · 0.45

Tested by

no test coverage detected