MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / appendNewLogData

Method appendNewLogData

src/gui/NetworkDiagnosticsDialog.cpp:1974–2016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1972}
1973
1974void NetworkDiagnosticsDialog::appendNewLogData()
1975{
1976 if (!m_logViewer) {
1977 return;
1978 }
1979
1980 const QString currentLogPath = LogManager::instance().logFilePath();
1981 if (!m_logFile.isOpen() || m_logFile.fileName() != currentLogPath) {
1982 if (!reopenLogFile(true)) {
1983 rebuildLogView();
1984 return;
1985 }
1986 }
1987
1988 const QFileInfo pathInfo(currentLogPath);
1989 if (!pathInfo.exists()) {
1990 if (!reopenLogFile(true)) {
1991 rebuildLogView();
1992 return;
1993 }
1994 }
1995
1996 const qint64 size = pathInfo.exists() ? pathInfo.size() : m_logFile.size();
1997 if (size < m_logOffset) {
1998 if (!reopenLogFile(false)) {
1999 rebuildLogView();
2000 return;
2001 }
2002 m_logFile.seek(0);
2003 m_logOffset = 0;
2004 m_logPartialLine.clear();
2005 addLogLine(QString("[--:--:--.---] INF default: Log file was reset; following from the beginning"));
2006 } else if (m_logFile.pos() != m_logOffset) {
2007 m_logFile.seek(m_logOffset);
2008 }
2009
2010 const QByteArray bytes = m_logFile.readAll();
2011 if (bytes.isEmpty()) {
2012 return;
2013 }
2014 m_logOffset = m_logFile.pos();
2015 appendLogText(QString::fromUtf8(bytes));
2016}
2017
2018void NetworkDiagnosticsDialog::appendLogText(const QString& text)
2019{

Callers

nothing calls this directly

Calls 5

logFilePathMethod · 0.45
isOpenMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected