MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / RotationLogAddItem

Method RotationLogAddItem

source/fdb.cpp:342–367  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

340}
341//---------------------------------------------------------------------------
342void TStorageFile::RotationLogAddItem(String fn, String & file_to_delete)
343{
344 TStringList * p = NULL;
345 String rlf = RotationLogFormatFileName();
346 try
347 {
348 p = new TStringList;
349 try { p->LoadFromFile(rlf); } catch(...) {}
350 p->Insert(0, fn);
351 // delete last item if limit of files exceeded
352 if( rotation_count > 0 )
353 if( p->Count > rotation_count )
354 {
355 file_to_delete = p->Strings[p->Count - 1];
356 p->Delete(p->Count - 1);
357 }
358 p->SaveToFile(rlf);
359 }
360 catch(const Exception & E)
361 {
362 WriteToLogError("ERROR\tRotationLogAddItem(%s): %s", rlf.c_str(), E.Message.c_str());
363 }
364 catch(...)
365 {}
366 delete p;
367}
368//---------------------------------------------------------------------------
369String TStorageFile::RotationLogGetItem(int num)
370{

Callers

nothing calls this directly

Calls 3

WriteToLogErrorFunction · 0.85
InsertMethod · 0.80
DeleteMethod · 0.80

Tested by

no test coverage detected