FMPLog.Builder

Description

The FMPLog.Builder class is a builder for the FMPLog class.

class Builder

Methods

Method Description

level(_:)

Save logging level to variable.
func level(_ level: FMPLog.Level) -> Builder

Parameters:

  • level. Logging level.

outputType(_:) Save log record type to variable.
func outputType(_ outputType: FMPLog.OutputType) -> Builder

Parameters:

  • outputType. Log record type.

database(_:) Save object of the database, with which FMPLog will work, to variable.
func database(_ database: FMPDatabase) -> Builder

Parameters:

  • database. Database for storing logs. It should differ from database for working with resource data.

databaseLimit(_:) Save the maximum number of log records in database to variable.
func databaseLimit(_ limit: Int32?) -> Builder

Parameters:

  • limit. The maximum number of log records in database. If there are nil, 0 values or less, the limit is not taken into account.

isEnabled(_:) It sets displaying of framework logs in the console.
func isEnabled(_ isEnabled: Bool = true) -> Builder

Parameters:

  • isEnabled. If the value is true, displaying of framework logs in the console is enabled. If the value is false, displaying of framework logs in the console is disabled.

isSecure(_:) It sets writing of secure data to log.
func isSecure(_ isSecure: Bool = true) -> Builder

Parameters:

  • isSecure. If the value is true, writing of secure data to log is disabled. If the value is false, writing of secure data to log is enabled.

build() Build an instance of the FMPLog class. It returns the object of the FMPLog type.
func build() -> FMPLog

Example

Build an instance of the FMPLog class:

// Build an instance of the FMPDatabase class. For details see examples for FMPDatabase.Builder.
let logDatabase: FMPDatabase = fmp.database.build()
  
// Build an instance of the FMPLog class with various settings
let log: FMPLog = fmp.log
    .database(logDatabase) // By default FMPDatabase(path: "", key: "")
    .databaseLimit(1000) // By default nil
    .isEnabled(true) // By default false
    .isSecure(false) // By default true
    .level(.database) // By default .verbose
    .outputType(.database) // By default .none
    .build()

See also:

FMPWrapper Framework | Classes