Updated on 2022-02-10 GMT+08:00

Initializing Logs

API Description

You can enable the SDK log function to record log information generated during API calling into log files for subsequent data analysis or fault location.

Method Definition

ObsClient.initLog(parameter)

Parameter Description

Field

Type

Optional or Mandatory

Description

name

String

Optional

Log name. When there are multiple instances of ObsClient, this parameter is used to identify log files.

file_full_path

String

Mandatory

Full path to the log file

max_log_size

String

Mandatory

Log file size in bytes

backups

String

Mandatory

Maximum number of retained log files

level

String

Mandatory

Log level. Possible values are debug, info, warn, and error.

log_to_console

Boolean

Optional

Whether to print logs to the console

Sample Code

obsClient.initLog({
       name: 'client1',
       file_full_path:'./logs/OBS-SDK.log', 
       max_log_size:20480, 
       backups:10, 
       level:'info', 
       log_to_console:false
});