AWSDDFileLogger

Objective-C

@interface AWSDDFileLogger : AWSDDAbstractLogger <AWSDDLogger> {
  AWSDDLogFileInfo *_currentLogFileInfo;
}

Swift

class AWSDDFileLogger : AWSDDAbstractLogger, AWSDDLogger

The standard implementation for a file logger

  • Undocumented

    Declaration

    Objective-C

    AWSDDLogFileInfo *_currentLogFileInfo
  • Default initializer

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    convenience init!()
  • Designated initializer, requires a AWSDDLogFileManager instance

    Declaration

    Objective-C

    - (instancetype)initWithLogFileManager:(id<AWSDDLogFileManager>)logFileManager;

    Swift

    init!(logFileManager: AWSDDLogFileManager!)
  • Called when the logger is about to write message. Call super before your implementation.

    Declaration

    Objective-C

    - (void)willLogMessage;

    Swift

    func willLogMessage()
  • Called when the logger wrote message. Call super after your implementation.

    Declaration

    Objective-C

    - (void)didLogMessage;

    Swift

    func didLogMessage()
  • Called when the logger checks archive or not current log file. Override this method to exdend standart behavior. By default returns NO.

    Declaration

    Objective-C

    - (BOOL)shouldArchiveRecentLogFileInfo:(AWSDDLogFileInfo *)recentLogFileInfo;

    Swift

    func shouldArchiveRecentLogFileInfo(_ recentLogFileInfo: AWSDDLogFileInfo!) -> Bool
  • Log File Rolling:

    maximumFileSize: The approximate maximum size (in bytes) to allow log files to grow. If a log file is larger than this value after a log statement is appended, then the log file is rolled.

    rollingFrequency How often to roll the log file. The frequency is given as an NSTimeInterval, which is a double that specifies the interval in seconds. Once the log file gets to be this old, it is rolled.

    doNotReuseLogFiles When set, will always create a new log file at application launch.

    Both the maximumFileSize and the rollingFrequency are used to manage rolling. Whichever occurs first will cause the log file to be rolled.

    For example: The rollingFrequency is 24 hours, but the log file surpasses the maximumFileSize after only 20 hours. The log file will be rolled at that 20 hour mark. A new log file will be created, and the 24 hour timer will be restarted.

    You may optionally disable rolling due to filesize by setting maximumFileSize to zero. If you do so, rolling is based solely on rollingFrequency.

    You may optionally disable rolling due to time by setting rollingFrequency to zero (or any non-positive number). If you do so, rolling is based solely on maximumFileSize.

    If you disable both maximumFileSize and rollingFrequency, then the log file won’t ever be rolled. This is strongly discouraged.

    Declaration

    Objective-C

    @property unsigned long long maximumFileSize;

    Swift

    var maximumFileSize: UInt64 { get set }
  • See description for maximumFileSize

    Declaration

    Objective-C

    @property NSTimeInterval rollingFrequency;

    Swift

    var rollingFrequency: TimeInterval { get set }
  • See description for maximumFileSize

    Declaration

    Objective-C

    @property BOOL doNotReuseLogFiles;

    Swift

    var doNotReuseLogFiles: Bool { get set }
  • The AWSDDLogFileManager instance can be used to retrieve the list of log files, and configure the maximum number of archived log files to keep.

    See

    AWSDDLogFileManager.maximumNumberOfLogFiles

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) id<AWSDDLogFileManager> logFileManager;

    Swift

    var logFileManager: AWSDDLogFileManager! { get }
  • When using a custom formatter you can set the logMessage method not to append \n character after each output. This allows for some greater flexibility with custom formatters. Default value is YES.

    Declaration

    Objective-C

    @property (nonatomic) BOOL automaticallyAppendNewlineForCustomFormatters;

    Swift

    var automaticallyAppendNewlineForCustomFormatters: Bool { get set }
  • You can optionally force the current log file to be rolled with this method. CompletionBlock will be called on main queue.

    Declaration

    Objective-C

    - (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock;

    Swift

    func rollLogFile() async
  • Deprecated

    Method is deprecated. @deprecated Use rollLogFileWithCompletionBlock: method instead.

    Declaration

    Objective-C

    - (void)rollLogFile;

    Swift

    func rollLogFile()
  • Returns the log file that should be used. If there is an existing log file that is suitable, within the constraints of maximumFileSize and rollingFrequency, then it is returned.

    Otherwise a new file is created and returned.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) AWSDDLogFileInfo *currentLogFileInfo;

    Swift

    var currentLogFileInfo: AWSDDLogFileInfo! { get }