errDump - Error reporting#
Adapted Air780E/Air700E Air780EP/Air780EPV Air601 Air101/Air103
Note
This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!
Tip
This library has its own demo,click this link to view errDump demo examples
Example
-- Basic usage, reported every 10 minutes, if any
if errDump then
errDump.config(true, 600)
end
-- Attached open source server side: https://gitee.com/openLuat/luatos-devlog
errDump.dump(zbuff, type, isDelete)#
Manually read exception logs, which are mainly used by users to send logs to their own servers instead of the IoT platform. If periodic upload is configured in errDump.config, this function cannot be used.
Parameters
Incoming Value Type |
Explanation |
---|---|
zbuff |
Log information is cached. If it is nil, it will not be read. Generally, when |
int |
Log type, currently only errDump.TYPE_SYS and errDump.TYPE_USR |
boolean |
Delete log |
Return Value
return value type |
explanation |
---|---|
boolean |
true Indicates that no data has been written before this read, false, otherwise, before deleting the log, it is better to read it again to ensure that no new data has been written. |
Examples
local result = errDump.dump(buff, errDump.TYPE_SYS, false) --Read out the exception log recorded by the system
local result = errDump.dump(nil, errDump.TYPE_SYS, true) --Clear system-logged exception logs
errDump.record(string)#
Write the user’s exception log, note that the maximum is only 4KB, more than part of the new cover the old, start automatic upload and upload to the full IOT platform
Parameters
Incoming Value Type |
Explanation |
---|---|
string |
Log |
Return Value
return value type |
explanation |
---|---|
nil |
No return value |
Examples
errDump.record("socket long time no connect") --Record"socket long time no connect"
errDump.config(enable, period, user_flag, custom_id, host, port)#
Configure key logs to upload to the IoT platform. The logs here include the logs that cause luavm to exit abnormally and the logs written by users through record, similar to errDump
Parameters
Incoming Value Type |
Explanation |
---|---|
boolean |
Whether to enable the recording function, false will not record any logs |
int |
Regular upload period, unit of seconds, default 600 seconds. This is the retry time after automatic upload. After startup or record operation, it will try to upload to the IOT platform once soon. If it is 0, it will not upload, and the user will upload his own platform after dump. |
string |
User’s special identity, can be empty |
string |
Device identification number, the default for 4G devices is imei, and the default for other devices is mcu.unique_id |
string |
Server domain name, default dev_msg1.openluat.com |
int |
Server port, default |
Return Value
return value type |
explanation |
---|---|
nil |
No return value |
Examples
errDump.config(true, 3600, "12345678") --Try the last time in an hour, and it will be attached after imei when uploading.12345678
errDump.config(false) --Turn off the recording function and no longer upload it.
errDump.config(true, 0) --Records, but will not take the initiative to upload, by the user to achieve the upload function
-- 2023.09.22 Added custom_id parameters
errDump.config(true, 3600, nil, "ABC") --Try the last time in an hour, use a custom device ID when uploading ABC
-- 2023.12.8 Add host and port parameters
errDump.config(true, 3600, nil, nil, "dev_msg1.openluat.com", 12425)