• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (Node.js SDK)
  4. Initialization
  5. Initializing Logs

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

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({
       file_full_path:'./logs/OBS-SDK.log', 
       max_log_size:20480, 
       backups:10, 
       level:'info', 
       log_to_console:false
});