1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "base/context.hpp"
4 #include <boost/thread/tss.hpp>
7 using namespace icinga;
9 static boost::thread_specific_ptr<std::list<String> > l_Frames;
11 ContextFrame::ContextFrame(const String& message)
13 GetFrames().push_front(message);
16 ContextFrame::~ContextFrame()
18 GetFrames().pop_front();
21 std::list<String>& ContextFrame::GetFrames()
24 l_Frames.reset(new std::list<String>());
29 ContextTrace::ContextTrace()
30 : m_Frames(ContextFrame::GetFrames())
33 void ContextTrace::Print(std::ostream& fp) const
41 for (const String& frame : m_Frames) {
42 fp << "\t(" << i << ") " << frame << "\n";
47 size_t ContextTrace::GetLength() const
49 return m_Frames.size();
52 std::ostream& icinga::operator<<(std::ostream& stream, const ContextTrace& trace)