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

    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. Click on the information property list file (default : “Info.plist”).

  2. Added The Application supports iTunes file sharing Key.

  3. 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.

  1. Click on the information property list file (default : “Info.plist”).

  2. Added The Supports opening documents in place Key.

  3. Set the value to YES .

3.6.1. sharedInstance

The singleton instance of the SMFileLogger class.

  • Declaration

    open class var shared: SMFileLogger { get }
    
  • Value

    Contents

    Type

    The singleton instance of the SMFileLogger class.

    SMFileLogger

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