|
SNAP Library 2.2, Developer Reference
2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <xfl.h>


Public Member Functions | |
| TFPathNotify (const TStr &_LogFPath, const TStr &_PrefixFNm, const bool &_FlushP) | |
| void | OnStatus (const TStr &MsgStr) |
Static Public Member Functions | |
| static PNotify | New (const TStr &LogFPath, const TStr &PrefixFNm, const bool &FlushP) |
Private Member Functions | |
| void | UpdateSOut (const TTm &NowTm) |
| UndefDefaultCopyAssign (TFPathNotify) | |
Private Attributes | |
| TStr | LogFPath |
| TStr | PrefixFNm |
| TTm | LastTm |
| PSOut | LogSOut |
| TBool | FlushP |
| TFPathNotify::TFPathNotify | ( | const TStr & | _LogFPath, |
| const TStr & | _PrefixFNm, | ||
| const bool & | _FlushP | ||
| ) |
Definition at line 266 of file xfl.cpp.
References TTm::GetCurUniTm(), LastTm, and UpdateSOut().
Referenced by New().
: LogFPath(_LogFPath), PrefixFNm(_PrefixFNm), FlushP(_FlushP) { LastTm = TTm::GetCurUniTm(); UpdateSOut(LastTm); }


| static PNotify TFPathNotify::New | ( | const TStr & | LogFPath, |
| const TStr & | PrefixFNm, | ||
| const bool & | FlushP | ||
| ) | [inline, static] |
Definition at line 97 of file xfl.h.
References TFPathNotify().
Referenced by UpdateSOut().
{
return PNotify(new TFPathNotify(LogFPath, PrefixFNm, FlushP));}


| void TFPathNotify::OnStatus | ( | const TStr & | MsgStr | ) | [virtual] |
Reimplemented from TNotify.
Definition at line 274 of file xfl.cpp.
References TSOut::Flush(), FlushP, TTm::GetCurUniTm(), TTm::GetHour(), LastTm, LogSOut, TSOut::PutStrLn(), and UpdateSOut().
{
// check if new hour so we switch to new log file
TTm NowTm = TTm::GetCurUniTm();
if (NowTm.GetHour() != LastTm.GetHour()) {
LastTm = NowTm; UpdateSOut(LastTm);
}
// write log line
LogSOut->PutStrLn(MsgStr);
// we flush for each line when in debug mode
if (FlushP) { LogSOut->Flush(); }
}

| TFPathNotify::UndefDefaultCopyAssign | ( | TFPathNotify | ) | [private] |
| void TFPathNotify::UpdateSOut | ( | const TTm & | NowTm | ) | [private] |
Definition at line 259 of file xfl.cpp.
References TPt< TRec >::Clr(), TStr::CStr(), TPt< TRec >::Empty(), TSOut::Flush(), TStr::Fmt(), TTm::GetDay(), TTm::GetHour(), TTm::GetMonth(), TTm::GetYear(), LogFPath, LogSOut, New(), and PrefixFNm.
Referenced by OnStatus(), and TFPathNotify().
{
if (!LogSOut.Empty()) { LogSOut->Flush(); LogSOut.Clr(); }
TStr FNm = TStr::Fmt("%s-Y%04d-M%02d-D%02d-H%02d.log", PrefixFNm.CStr(),
Tm.GetYear(), Tm.GetMonth(), Tm.GetDay(), Tm.GetHour());
LogSOut = TFOut::New(LogFPath + FNm, true);
}


TBool TFPathNotify::FlushP [private] |
Definition at line 89 of file xfl.h.
Referenced by OnStatus().
TTm TFPathNotify::LastTm [private] |
Definition at line 87 of file xfl.h.
Referenced by OnStatus(), and TFPathNotify().
TStr TFPathNotify::LogFPath [private] |
Definition at line 85 of file xfl.h.
Referenced by UpdateSOut().
PSOut TFPathNotify::LogSOut [private] |
Definition at line 88 of file xfl.h.
Referenced by OnStatus(), and UpdateSOut().
TStr TFPathNotify::PrefixFNm [private] |
Definition at line 86 of file xfl.h.
Referenced by UpdateSOut().