3.6. SMFileLogger

This class provides the function which outputs the StarIO.framework and StarIO_Extension.framework logs to files. It extends the SMLogger class.

  • Property

    Name Description
    sharedInstance The singleton instance of the SMFileLogger class.
    maxLogSize Specifies the maximum log size to be kept.
    logDirectoryPath 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.

  1. Select the Information Property List (“Info.plist” by default).
  2. Added Key Application supports iTunes file sharing
  3. Set YES to [Value] of “Item 0” displayed by clicking â–½ on the left side of the item name
Ex. 2: Using opening documents in place

It is necessary to set items to Information Property List. The setting procedure is as follows.

  1. Select the Information Property List (“Info.plist” by default).
  2. Added Key Supports opening documents in place
  3. Set YES to [Value] of “Item 0” displayed by clicking â–½ on the left side of the item name

3.6.1. sharedInstance

The singleton instance of the SMFileLogger class.

  • Declaration

    open class var shared: SMFileLogger { get }
    
  • Value

    Description Object type
    The singleton class of the SMFileLogger instance. SMFileLogger

3.6.2. maxLogSize

Specifies the maximum log size to be kept.

  • Declaration

    open var maxLogSize: UInt
    
  • Value

    Description Object 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

    Description Object 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()