Пример #1
0
//! destination factory
DestinationPtr DestinationFactory::MakeFileDestination(const QString& filePath, bool enableRotation,
                                                       qint64 sizeInBytesToRotateAfter, int oldLogsToKeep)
{
    if (enableRotation) {
        QScopedPointer<SizeRotationStrategy> logRotation(new SizeRotationStrategy);
        logRotation->setMaximumSizeInBytes(sizeInBytesToRotateAfter);
        logRotation->setBackupCount(oldLogsToKeep);

        return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(logRotation.take())));
    }

    return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(new NullRotationStrategy)));
}
Пример #2
0
//! destination factory
DestinationPtr DestinationFactory::MakeFileDestination(const QString& filePath,
    LogRotationOption rotation, const MaxSizeBytes &sizeInBytesToRotateAfter,
    const MaxOldLogCount &oldLogsToKeep)
{
    if (EnableLogRotation == rotation) {
        QScopedPointer<SizeRotationStrategy> logRotation(new SizeRotationStrategy);
        logRotation->setMaximumSizeInBytes(sizeInBytesToRotateAfter.size);
        logRotation->setBackupCount(oldLogsToKeep.count);

        return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(logRotation.take())));
    }

    return DestinationPtr(new FileDestination(filePath, RotationStrategyPtr(new NullRotationStrategy)));
}