When user-compiled scripts are running on a device, some information is recorded in the device's log.
opsObj.syslog(content, severity="informational", logtype="syslog")
Method |
Description |
---|---|
opsObj |
Specifies an OPS object. It is obtained through ops.ops() instantiation. |
content |
Specifies the log content. The maximum length of the character string is 512 bytes. If the length exceeds 512 bytes, the log fails to be recorded. |
severity |
Specifies a log level, which can be CRITICAL, ERROR, WARNING, or INFORMATIONAL (in descending order). The default level is INFORMATIONAL. |
logtype |
Specifies a log type, which can be syslog or diagnose. If syslog is specified, information is recorded in the syslog. After a syslog server is configured, the syslog is uploaded to the syslog server. If diagnose is specified, information is recorded in the diagnostic log on the device. The default value is syslog. |
test.py import ops opsObj = ops.ops() opsObj.syslog("Record an informational syslog.")
After the script is run, information is recorded in the syslog.