3.6. SMFileLogger
This class provides the function which outputs the StarIO.xcframework and StarIO_Extension.xcframework logs to files. It extends the SMLogger class.
Note
When inquiring using the logs recorded by this class, please also provide the date and time of the event that may have caused the problem.
Property
Name
Contents
The singleton instance of the SMFileLogger class.
Specifies the maximum log size to be kept.
The directory path of log files to save.
The output log file is saved under the Documents/starlog directory of the application. You can access the saved file by using the file sharing function.
- Ex. 1: When using iTunes file sharing
It is necessary to set items to Information Property List. The setting procedure is as follows.
Click on the information property list file (default : “Info.plist”).
Added The
Application supports iTunes file sharing
Key.Set the value to
YES
.
- Ex. 2: Using opening documents in place
It is necessary to set items to Information Property List. The setting procedure is as follows.
Click on the information property list file (default : “Info.plist”).
Added The
Supports opening documents in place
Key.Set the value to
YES
.
3.6.2. maxLogSize
Specifies the maximum log size to be kept.
Declaration
open var maxLogSize: UInt
Value
Contents
Type
Maximum log size to be kept (in MB)Default value: 50 (MB)If 0 is specified, no limit on log size is set.UInt
3.6.3. logDirectoryPath
The directory path of log files to save.
Declaration
open var logDirectoryPath: String { get }
Value
Contents
Type
The directory path of log files to save “Documents/starlog” is set.
String
3.6.4. Sample of log output using the SMFileLogger class
// Get SMFileLogger class singleton instance.
let logger = SMFileLogger.shared
// Set the log level.
logger.logLevel = .default
// Set the maximum log size to be kept (optional).
logger.maxLogSize = 10
// Start log output.
logger.start()
// Output the desired character string (optional).
logger.log("(Log message)")
// Stop log output.
logger.stop()