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

Log Initialization

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.

Initialization Method

func InitLog(logFullPath string, maxLogSize int64, backups int, level Level, logToConsole bool) error

Parameter Description

Field

Type

Optional or Mandatory

Description

logFullPath

string

Mandatory

Full path to the log file

maxLogSize

int64

Mandatory

Log file size in bytes

backups

int

Mandatory

Maximum number of log files that can be retained

level

Level

Mandatory

Log level

logToConsole

bool

Mandatory

Whether to print logs to the console

Sample Code

import (
       "obs"
)

func main() {
        obs.InitLog("./logs/OBS-SDK.log", 20480, 10, obs.LEVEL_INFO, false)
}