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 PlanetKitManager::Initialize()
with a Configuration
object. After that, you must set planet_base_url
through UpdateServerUrl()
.
You can find planet_base_url
for each environment in Development environment.
void YourApplication::InitializePlanetkit()
{
PlanetKit::ELogLevel eLogLevel = PlanetKit::PLNK_LOG_SIMPLE;
PlanetKit::ELogSizeLimit eLogSizeLimit = PlanetKit::PLNK_LOG_SIZE_LIMIT_SMALL;
PlanetKit::ConfigurationPtr pConfiguration = PlanetKit::Configuration::Create(L"./", L"./");
pConfiguration->SetLogLevel(eLogLevel);
pConfiguration->SetLogSizeLimit(eLogSizeLimit);
pConfiguration->EnableLogOutput(true);
PlanetKit::PlanetKitManager::Initialize(pConfiguration);
PlanetKit::PlanetKitManagerPtr pPlanetKitManager = PlanetKit::PlanetKitManager::GetInstance();
pPlanetKitManager->UpdateServerUrl(planet_base_url);
}
Log setting
If you need to debug, you must use methods of the Configuration
class to enable logging and set configurations during initialization.
Enable logging
To enable logging, call EnableLogOutput()
with true
. 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, use SetLogLevel()
with one of the values in ELogLevel
. Available log level settings are as follows:
PLNK_LOG_SILENT
: PlanetKit does not output any debug information. (default)PLNK_LOG_SIMPLE
: PlanetKit outputs simple debug information.PLNK_LOG_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
PLNK_LOG_DETAILED
level.
Set the log size limit
To set the total size limit of log files, use SetLogSizeLimit()
with one of the values in ELogSizeLimit
. Available log size limit settings are as follows:
PLNK_LOG_SIZE_LIMIT_SMALL
: The total size limit of log files is 16MB.PLNK_LOG_SIZE_LIMIT_MEDIUM
: The total size limit of log files is 64MB.PLNK_LOG_SIZE_LIMIT_LARGE
: The total size limit of log files is 256MB. (default)PLNK_LOG_SIZE_LIMIT_UNLIMITED
: The total size of log files is unlimited.