1
////////////////////////////////////////////////////////////////////////////////
2
/*! @file Log.cpp Собирает структурированную трассировочную информацию.
3
- Part of RANet - Research Assistant Net Library (based on ANSI C++).
4
- Copyright(C) 2011, Viktor E. Bursian, St.Petersburg, Russia.
5
Viktor.Bursian@mail.ioffe.ru
6
*///////////////////////////////////////////////////////////////////////////////
10
//------------------------------------------------------------------------------
18
//--------------------------------------------------------------- sLog::sItem---
20
sLog::sItem::sItem (psItem parent
26
,TheSeverity(severity)
36
sString sLog::sItem::Text () const
49
//---------------------------------------------------------------------- sLog---
60
,TheShowSeverity(Admin)
65
void sLog::Put (eSeverity severity
70
if( severity <= Debug )
73
psItem I( new sItem(CurrentBlock
78
if( ( (severity >= TheShowSeverity)
79
&& (TopicsToHide.count(topic) == 0) )
80
|| (TopicsToShow.count(topic) != 0) ){
81
for( unsigned int i = 0 ; i < I->Level() ; i++) std::cout << "\t";
82
std::cout << (literal)(I->Text()) << std::endl;
88
void sLog::OpenBlock (eSeverity severity
93
if( severity <= Debug )
96
Put(severity,topic,message);
101
void sLog::OpenBlock (eSeverity severity
104
OpenBlock(severity,topic,"started");
108
void sLog::CloseBlock (eSeverity severity
112
if( severity <= Debug )
115
// if( ! CurrentBlock || (severity != CurrentBlock->TheSeverity)
116
// || (topic != CurrentBlock->TheTopic) ){
120
Put(severity,topic,"finished"); // duration= total=");
126
void sLog::SetShowSeverity (eSeverity severity)
128
TheShowSeverity = severity;
132
void sLog::AlwaysHide (sString topic)
134
TopicsToHide.insert(topic);
135
TopicsToShow.erase(topic);
139
void sLog::AlwaysShow (sString topic)
141
TopicsToShow.insert(topic);
142
TopicsToHide.erase(topic);
145
//------------------------------------------------------------------------------