PlanetKit initialization and log setting
You must initialize PlanetKit before using any functions of LINE Planet in your application. This page provides a code example for initializing PlanetKit and configuring log settings.
Initialization
Initialize PlanetKit using initialize()
of PlanetKitManger
with a PlanetKitInitialSettingBuilder
object. You must set planet_base_url
when calling initialize()
.
You can find planet_base_url
for each environment in Development environment.
class YourApplication {
func initializePlanetKit() {
let logLevel: PlanetKitLogLevel = .simple
let logSizeLimit: PlanetKitLogSizeLimit = .small
let settingBuilder = PlanetKitInitialSettingBuilder()
.withEnableKitLogKey(level: logLevel, enable: true, logSize: logSizeLimit)
.withSetKitServerKey(serverUrl: planet_base_url)
let initialSettings = settingBuilder.build()
PlanetKitManager.shared.initialize(initialSettings: initialSettings)
...
}
}
Log setting
If you need to debug, you must use withEnableKitLogKey(level:enable:logSize)
of PlanetKitInitialSettingBuilder
to enable logging and set configurations during initialization.
Enable logging
To enable logging, set enable: true
when calling withEnableKitLogKey(level:enable:logSize)
. By default, the logging is disabled.
Starting with PlanetKit 5.1, logs can be output to files only.
Set the log level
You can adjust the level of debug information output by setting the log level.
To set the log level, set the level
parameter of withEnableKitLogKey(level:enable:logSize)
to one of the values in PlanetKitLogLevel
. Available log level settings are as follows:
silent
: PlanetKit does not output any debug information. (default)simple
: PlanetKit outputs simple debug information.detailed
: PlanetKit outputs detailed debug information.
- The log levels have been changed since PlanetKit 5.2.
- To request debugging to the LINE Planet team, you must send a log file created with the
detailed
level.
Set the log size limit
To set the total size limit of log files, set the logSize
parameter of withEnableKitLogKey(level:enable:logSize)
to one of the values in PlanetKitLogSizeLimit
. Available log size limit settings are as follows:
small
: The total size limit of log files is 16MB.medium
: The total size limit of log files is 64MB.large
: The total size limit of log files is 256MB. (default)unlimited
: The total size of log files is unlimited.