try (DebugContext debug = command.getDebug(bb.getOptions(), bb.getDebugHandlerFactories()); Scope s = debug.scope("Operation")) { command.run(debug); try (DebugContext debug = command.getDebug(bb.getOptions(), bb.getDebugHandlerFactories()); Scope s = debug.scope("Operation")) { command.run(debug); } catch (Throwable x) { thrown = x;
/** * Gets a {@link DebugContext} the executor will use for this task. * * A task can override this and return {@link DebugContext#DISABLED} to avoid the cost of * creating a {@link DebugContext} if one is not needed. */ default DebugContext getDebug(OptionValues options, List<DebugHandlersFactory> factories) { return DebugContext.create(options, getDescription(), NO_GLOBAL_METRIC_VALUES, DEFAULT_LOG_STREAM, factories); } }