QtCraft API C++ classes QML types Handbook

QcLogFiles Namespace

The files of the diagnostics folder (decision E-834): one session per start of a program, named "<program>-<yyyyMMdd-HHmmss>" in UTC (so the order survives a change of daylight saving time; the lines inside carry local time), with "-2", "-3" … when that name is taken. More...

Header: #include <common/diagnostics/QcLogFiles.h>

Variables

const int defaultKeptSessions
const char[5] folderName

Functions

QStringList bundleFiles(const QDir &dir, int sessionsPerProgram)
QString crashReportName(const QString &session)
QString dumpName(const QString &session)
QString freeSessionName(const QDir &dir, const QString &program, const QDateTime &start)
QString logName(const QString &session)
QString markSeen(const QString &reportPath)
QString previousCrashReport(const QDir &dir, const QString &program, const QString &current)
QStringList prune(const QDir &dir, const QString &program, int keep)
QString rotatedPath(const QString &logPath, int part)
QString seenCrashReportName(const QString &session)
QStringList sessions(const QDir &dir, const QString &program)

Detailed Description

A session's files share its name: the log "<session>.log", its rotated parts "<session>.1.log" …, a crash report "<session>.crash.txt" (renamed to "<session>.crash-seen.txt" once a later start named it) and on Windows a memory dump "<session>.dmp".

Variable Documentation

const int QcLogFiles::defaultKeptSessions

Sessions kept per program; older ones are deleted at the start of a new one.

const char[5] QcLogFiles::folderName

The folder below the data root.

Function Documentation

QStringList QcLogFiles::bundleFiles(const QDir &dir, int sessionsPerProgram)

Returns the files of dir a diagnostics bundle carries: those of the newest sessionsPerProgram sessions of every program and every crash report and dump, sorted by name.

QString QcLogFiles::crashReportName(const QString &session)

Returns the crash report's file name of session: "<session>.crash.txt".

QString QcLogFiles::dumpName(const QString &session)

Returns the memory dump's file name of session: "<session>.dmp".

QString QcLogFiles::freeSessionName(const QDir &dir, const QString &program, const QDateTime &start)

Returns a session name for program started at start that no file in dir uses yet.

QString QcLogFiles::logName(const QString &session)

Returns the log's file name of session: "<session>.log".

QString QcLogFiles::markSeen(const QString &reportPath)

Renames the crash report reportPath found by previousCrashReport() so later starts do not name it again (sessions without a log leave no file of their own); returns the new path, or the old one when the rename failed.

QString QcLogFiles::previousCrashReport(const QDir &dir, const QString &program, const QString &current)

Returns the path of the crash report in dir of the newest session of program before current that no start named yet; empty when that session ended without one.

QStringList QcLogFiles::prune(const QDir &dir, const QString &program, int keep)

Deletes the files in dir of all but the newest keep sessions of program; returns the deleted file names.

QString QcLogFiles::rotatedPath(const QString &logPath, int part)

Returns the rotated part part (1 = the newest) of the log at logPath: "<dir>/<session>.<part>.log".

QString QcLogFiles::seenCrashReportName(const QString &session)

Returns the file name of the crash report of session once a later start named it: "<session>.crash-seen.txt".

QStringList QcLogFiles::sessions(const QDir &dir, const QString &program)

Returns the sessions of program with files in dir, oldest first.