MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / unsafeValidateFileRolling

Method unsafeValidateFileRolling

src/thundersvm/util/log.cpp:1743–1760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1741 }
1742
1743 bool TypedConfigurations::unsafeValidateFileRolling(Level level, const PreRollOutCallback& preRollOutCallback) {
1744 base::type::fstream_t* fs = unsafeGetConfigByRef(level, &m_fileStreamMap, "fileStream").get();
1745 if (fs == nullptr) {
1746 return true;
1747 }
1748 std::size_t maxLogFileSize = unsafeGetConfigByVal(level, &m_maxLogFileSizeMap, "maxLogFileSize");
1749 std::size_t currFileSize = base::utils::File::getSizeOfFile(fs);
1750 if (maxLogFileSize != 0 && currFileSize >= maxLogFileSize) {
1751 std::string fname = unsafeGetConfigByRef(level, &m_filenameMap, "filename");
1752 ELPP_INTERNAL_INFO(1, "Truncating log file [" << fname << "] as a result of configurations for level ["
1753 << LevelHelper::convertToString(level) << "]");
1754 fs->close();
1755 preRollOutCallback(fname.c_str(), currFileSize);
1756 fs->open(fname, std::fstream::out | std::fstream::trunc);
1757 return true;
1758 }
1759 return false;
1760 }
1761
1762// RegisteredHitCounters
1763

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected