CN-121996492-A - Log collection method and device, electronic equipment and storage medium
Abstract
The disclosure relates to a log collection method, a log collection device, electronic equipment and a storage medium. The method comprises the steps of responding to a target instruction, obtaining indication information, wherein the target instruction is used for indicating collection of log information of a target sensor, the indication information is used for indicating the target sensor, and collecting the log information of the target sensor based on the indication information. According to the method, based on the indication information, the needed log information of the target sensor is collected, the log information of all sensors does not need to be collected first, then the log information of the target sensor is screened out from the log information of all sensors, the process of obtaining the log information of the target sensor is simplified, the time consumption is reduced, and the collection speed of the log information is improved.
Inventors
- WANG HUAN
- LI XU
- LIU YANXIA
Assignees
- 北京小米移动软件有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241108
Claims (14)
- 1. A method of log collection, the method comprising: the method comprises the steps of responding to a target instruction, and obtaining indication information, wherein the target instruction is used for indicating collection of log information of a target sensor, and the indication information is used for indicating the target sensor; and collecting log information of the target sensor based on the indication information.
- 2. The log collection method of claim 1, wherein the method further comprises: Acquiring user feedback information, wherein the user feedback information comprises sensor abnormality information, and the sensor abnormality information is used for indicating a sensor abnormal in the current electronic equipment; and generating the target instruction based on the sensor abnormality information.
- 3. The log collection method of claim 1, wherein the method further comprises: in response to detecting an instruction input operation, the target instruction is obtained.
- 4. The log collection method according to claim 1, wherein the collecting log information of the target sensor based on the indication information includes: determining a sensor identifier corresponding to the indication information based on a first corresponding relation, wherein the first corresponding relation comprises a corresponding relation between the indication information and the sensor identifier; and collecting log information of the target sensor corresponding to the sensor identification.
- 5. The log collection method of claim 1 or 4, wherein the method further comprises: determining a physical sensor associated with the target sensor when the target sensor is a virtual sensor; Log information of physical sensors associated with the target sensor is collected.
- 6. The log collection method according to claim 1, wherein the collecting log information of the target sensor based on the indication information includes: Configuring preset parameters based on the indication information to obtain configured preset parameters, wherein the configured preset parameters are used for indicating to collect log information of the target sensor and not collecting log information of other sensors except the target sensor; and collecting log information of the target sensor based on the configured preset parameters.
- 7. The method for collecting logs according to claim 6, wherein the preset parameters include a plurality of flag bits, each flag bit corresponds to a sensor, a value on the flag bit is used for indicating whether to collect log information of the sensor corresponding to the flag bit, the configuring the preset parameters based on the indication information to obtain the configured preset parameters includes: and configuring the numerical value on each zone bit in the preset parameters based on the indication information to obtain the configured preset parameters.
- 8. The log collection method according to claim 7, wherein configuring the value on each flag bit in the preset parameter based on the indication information comprises: based on the indication information, setting the numerical value on a target zone bit in the preset parameter as a first preset value, and setting the numerical values on other zone bits except the target zone bit in the preset parameter as a second preset value; The target zone bit is a zone bit corresponding to the target sensor, the value on the zone bit is a first preset value used for indicating that the log information of the sensor corresponding to the zone bit is collected, and the value on the zone bit is a second preset value used for indicating that the log information of the sensor corresponding to the zone bit is not collected.
- 9. The log collection method of claim 1, wherein the obtaining, in response to the target instruction, the indication information comprises: In response to the target instruction, acquiring the indication information through an application processor; the collecting log information of the target sensor based on the indication information includes: and collecting log information of the target sensor based on the indication information through a sensor hub.
- 10. The log collection method of claim 9, wherein the method further comprises: and sending the indication information to the sensor hub by the application processor in a preset communication mode.
- 11. The log collection method of claim 9, wherein the method further comprises: storing the indication information into a preset storage area through the application processor; And reading the indication information from the preset storage area through the sensor hub.
- 12. A log collection device, the device comprising: The system comprises an indication information acquisition module, a target sensor acquisition module and a control module, wherein the indication information acquisition module is configured to respond to a target instruction, and the target instruction is used for indicating collection of log information of a target sensor, and the indication information is used for indicating the target sensor; And a log collection module configured to collect log information of the target sensor based on the indication information.
- 13. An electronic device, comprising: A processor; A memory for storing processor-executable instructions; Wherein the processor is configured to perform the log collection method of any of claims 1-11.
- 14. A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the log collection method of any one of claims 1-11.
Description
Log collection method and device, electronic equipment and storage medium Technical Field The disclosure relates to the field of computer technology, and in particular, to a log collection method, a log collection device, electronic equipment and a storage medium. Background The number of sensors mounted in Sensorhub (sensor hub) in the electronic device may be tens or hundreds, at present, when the operation condition of a specific sensor is wanted to be known, only log information of all sensors can be collected, and then a user screens out the log information of the specific sensor from the log information of all sensors, so that the process of obtaining the log information of the specific sensor is complicated and time-consuming. Disclosure of Invention In order to overcome the problems in the related art, the present disclosure provides a log collection method, apparatus, electronic device, and storage medium. According to a first aspect of embodiments of the present disclosure, there is provided a log collection method, the method including: the method comprises the steps of responding to a target instruction, and obtaining indication information, wherein the target instruction is used for indicating collection of log information of a target sensor, and the indication information is used for indicating the target sensor; and collecting log information of the target sensor based on the indication information. In some embodiments, the method further comprises: Acquiring user feedback information, wherein the user feedback information comprises sensor abnormality information, and the sensor abnormality information is used for indicating a sensor abnormal in the current electronic equipment; and generating the target instruction based on the sensor abnormality information. In some embodiments, the method further comprises: in response to detecting an instruction input operation, the target instruction is obtained. In some embodiments, the collecting log information of the target sensor based on the indication information includes: determining a sensor identifier corresponding to the indication information based on a first corresponding relation, wherein the first corresponding relation comprises a corresponding relation between the indication information and the sensor identifier; and collecting log information of the target sensor corresponding to the sensor identification. In some embodiments, the method further comprises: determining a physical sensor associated with the target sensor when the target sensor is a virtual sensor; Log information of physical sensors associated with the target sensor is collected. In some embodiments, the collecting log information of the target sensor based on the indication information includes: Configuring preset parameters based on the indication information to obtain configured preset parameters, wherein the configured preset parameters are used for indicating to collect log information of the target sensor and not collecting log information of other sensors except the target sensor; and collecting log information of the target sensor based on the configured preset parameters. In some embodiments, the preset parameters include a plurality of flag bits, each flag bit corresponds to a sensor, the value on the flag bit is used for indicating whether to collect log information of the sensor corresponding to the flag bit, the configuring the preset parameters based on the indication information, and the obtaining the configured preset parameters includes: and configuring the numerical value on each zone bit in the preset parameters based on the indication information to obtain the configured preset parameters. In some embodiments, the configuring the value on each flag bit in the preset parameter based on the indication information includes: based on the indication information, setting the numerical value on a target zone bit in the preset parameter as a first preset value, and setting the numerical values on other zone bits except the target zone bit in the preset parameter as a second preset value; The target zone bit is a zone bit corresponding to the target sensor, the value on the zone bit is a first preset value used for indicating that the log information of the sensor corresponding to the zone bit is collected, and the value on the zone bit is a second preset value used for indicating that the log information of the sensor corresponding to the zone bit is not collected. In some embodiments, the obtaining, in response to the target instruction, indication information includes: In response to the target instruction, acquiring the indication information through an application processor; the collecting log information of the target sensor based on the indication information includes: and collecting log information of the target sensor based on the indication information through a sensor hub. In some embodiments, the method further comprises: and sending the indication