DDLogFileManagerDefault
Objective-C
@interface DDLogFileManagerDefault : NSObject <DDLogFileManager>
Swift
class DDLogFileManagerDefault : NSObject, DDLogFileManager
Default log file manager.
All log files are placed inside the logsDirectory.
If a specific logsDirectory isn’t specified, the default directory is used.
On Mac, this is in ~/Library/Logs/<Application Name>
.
On iPhone, this is in ~/Library/Caches/Logs
.
Log files are named "<bundle identifier> <date> <time>.log"
Example: com.organization.myapp 2013-12-03 17-14.log
Archived log files are automatically deleted according to the maximumNumberOfLogFiles
property.
-
Default initializer
Declaration
Objective-C
- (nonnull instancetype)init;
Swift
convenience init()
-
If logDirectory is not specified, then a folder called “Logs” is created in the app’s cache directory. While running on the simulator, the “Logs” folder is located in the library temporary directory.
Declaration
Objective-C
- (nonnull instancetype)initWithLogsDirectory: (nullable NSString *)logsDirectory;
Swift
init(logsDirectory: String?)
-
Generates log file name with default format
"<bundle identifier> <date> <time>.log"
Example:MobileSafari 2013-12-03 17-14.log
You can change it by overriding
newLogFileName
andisLogFile:
methods.Declaration
Objective-C
@property (copy, readonly) NSString *_Nonnull newLogFileName;
Swift
var newLogFileName: String { get }
-
Default log file name is
"<bundle identifier> <date> <time>.log"
. Example:MobileSafari 2013-12-03 17-14.log
You can change it by overriding
newLogFileName
andisLogFile:
methods.Declaration
Objective-C
- (BOOL)isLogFile:(nonnull NSString *)fileName;
Swift
func isLogFile(withName fileName: String) -> Bool
-
New log files are created empty by default in
createNewLogFile:
methodIf you wish to specify a common file header to use in your log files, you can set the initial log file contents by overriding
logFileHeader
Declaration
Objective-C
@property (copy, readonly, nullable) NSString *logFileHeader;
Swift
var logFileHeader: String? { get }