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 |
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)
}
Last Article: ObsClient Initialization
Next Article: SDK Custom Errors
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.