Line data Source code
1 : #pragma once 2 : 3 : #include <ostream> 4 : 5 : #include "envoy/common/pure.h" 6 : 7 : namespace Envoy { 8 : 9 : /* 10 : * An interface for tracking the scope of work. Implementors of this interface 11 : * can be registered to the dispatcher when they're active on the stack. If a 12 : * fatal error occurs while they were active, the dumpState method will be 13 : * called. 14 : * 15 : * Currently this is only used for the L4 network connection and L7 stream. 16 : */ 17 : class ScopeTrackedObject { 18 : public: 19 19774 : virtual ~ScopeTrackedObject() = default; 20 : 21 : /** 22 : * Dump debug state of the object in question to the provided ostream. 23 : * 24 : * This is called on Envoy fatal errors, so should do minimal memory allocation. 25 : * 26 : * @param os the ostream to output to. 27 : * @param indent_level how far to indent, for pretty-printed classes and subclasses. 28 : */ 29 : virtual void dumpState(std::ostream& os, int indent_level = 0) const PURE; 30 : }; 31 : 32 : } // namespace Envoy