Service log viewing and exporting method based on mining equipment
By establishing a long WS connection in mining equipment for real-time log viewing and historical log export, the problems of complex operations and inaccurate time periods in the existing technology are solved, and simplified operation and efficient troubleshooting are achieved.
Patent Information
- Application Number
- CN202510492931.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2025-08-01
AI Technical Summary
The prior art service log viewing and exporting operations in mining equipment are complicated, and it is difficult to achieve accurate exporting to the time period of failure, which affects work efficiency.
The WS client established by the main program connects long-term connection with the WS server established by the device application, real-time log viewing, and query the log content of the specified time period by setting a time stamp, writing the log content to a local file, simplifying the operation into a page display of the desktop application.
It reduces operation difficulty, improves the efficiency of mining equipment troubleshooting, realizes rapid service log export and viewing, and has good market promotion prospects.
Smart Images

Figure CN120407533A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of mining equipment, and particularly to a method for viewing and exporting service logs of mining equipment. Background Art
[0002] With the continuous development of Internet technology, R & D workers and underground practitioners have higher and higher requirements for the real-time and convenience of maintenance work. In the original maintenance mode, R & D personnel need to connect to the equipment, open the shell terminal tool, and execute corresponding script commands in the program file through the shell to view and export the logs of services on the equipment. Its operation difficulty is relatively large, which is not conducive to popularization and use; moreover, when exporting logs, it is impossible to export accurately to the fault occurrence time period, which is not conducive to troubleshooting problems. In the actual development and test environment, it greatly affects work efficiency, and it is necessary to improve it. Summary of the Invention
[0003] The object of the present invention is to provide a method for viewing and exporting service logs of mining equipment that simplifies the operation process and reduces the operation difficulty.
[0004] To achieve the above object, the technical solution of the present invention is as follows:
[0005] A method for viewing and exporting service logs of mining equipment, comprising the following steps:
[0006] S1. The rendering process sends message data to the preloading process;
[0007] S2. After receiving the message data, the preloading process sends the message data to the main program;
[0008] S3. After the main program monitors the message data, it judges whether to perform an export operation or a viewing operation on the service log according to the requirements of the message data; when performing an export operation on the service log, step S4 is carried out; when performing a viewing operation on the service log, step S7 is carried out;
[0009] S4. The main program calls the export log interface, and converts the service log time period information to be exported into a timestamp and sends it to the device application program;
[0010] S5. The device application program calls the log service port to query the historical service logs within the timestamp range and returns the log information of the historical service logs to the device application program;
[0011] S6. After the device application program receives the log information, it converts its format and transmits it to the main program; the main program calls the Node module to write the converted log information into a local json file; then step S8 is carried out;
[0012] S7. The main program creates a WS client. The WS client establishes a long connection with the WS server established by the device application. The WS server calls the log service port to query the real-time service log and transmits it to the main program through the WS server. The main program generates real-time log information from the real-time service log; then, proceed to step S8;
[0013] S8. The main program returns the local json file or real-time log information to the listening event of the preloading process;
[0014] S9. The rendering process listens and receives the returned local json file or real-time log information through window.bridge opened by the preloading process, and then completes the service log viewing or export processing operation.
[0015] Further, in step S1, the rendering process sends message data to the preloading process by calling IPC.
[0016] Further, in step S2, the preloading process sends the message data to the main program by calling the ipcRenderer.invoke module.
[0017] Further, in step S3, the main program listens to the message data sent by the preloading process through the ipcMain.handle module.
[0018] Further, in step S7, the connection established between the WS client and the WS server is full-duplex communication.
[0019] Compared with the prior art, the advantages and positive effects of the present invention are:
[0020] The present invention mainly realizes the viewing and export operation of the service log of mining equipment. It realizes the function of real-time log viewing through the long connection between the WS client established by the main program and the WS server established by the device application, and queries the log content of the specified time period by setting the timestamp. Finally, it writes the log content into the local file to realize the function of historical log export; it simplifies the complex commands into the page display of the desktop application, greatly reducing the operation difficulty of on-site operation and maintenance. And it can directly export the service log of the required time period, which is beneficial to quickly troubleshoot equipment failures, thus effectively improving the working efficiency of mining equipment and having excellent market promotion prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0022] Figure 1 This is the process logic diagram of the present invention. Specific embodiments
[0023] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts, any modifications, equivalent replacements, improvements, etc., shall be included in the protection scope of the present invention.
[0024] The present invention mainly realizes the operations of viewing and exporting service logs of mining equipment. The log viewing function realizes real-time log viewing by establishing a long connection between the WS client and the WS server established by the device application program. The historical logs realize the function of exporting historical logs by querying the log content within a specified time period and writing the log content to a local file.
[0025] As Figure 1 shown, the specific operation method steps of the present invention are as follows:
[0026] Step 1: The rendering process uses IPC to call the method thrown by the preloading process and waits for the preloading process to reply;
[0027] Step 2: In the preloading process, ipcRenderer.invoke is called to send a message to the main process. The main process listens for events through ipcMain.handle and determines which script to execute based on the message. After the handle event is executed, the execution result is returned;
[0028] Step 3: Determine the interface to be called; when viewing real-time logs, create a WS client to establish a long connection with the corresponding client to receive log information in full-duplex communication; when exporting logs, convert the information of the time period to be exported into a timestamp and send it to the device application program.
[0029] Step 4: After the device initialization is completed, the log service port starts to collect service logs and stores the service logs in the device memory for subsequent query;
[0030] Step 5: The device application program responds to the interface call according to the main program requirements; when viewing real-time logs, create a WS server to query log data from the log service; when exporting logs, call the log service to query historical logs for a specified time period;
[0031] Step 6: When exporting logs, according to the timestamp of the corresponding period sent by the device application program, query the corresponding log information and return the original log information;
[0032] Step 7: After the device application program receives the original log information returned by the log service, format the specified original log information into a log style for easy reading;
[0033] Step 8: After the historical log query is completed and returned to the main program, the main program calls the file reading and writing capabilities of Node to create a log folder locally and write the corresponding original log information into a json file;
[0034] Step 9: When viewing real-time logs, use the full-duplex communication websocket to implement the query and display of real-time log information;
[0035] Step 10: The main process returns the received real-time log message or json file to the listening event of the invoke method of the rendering process;
[0036] Step 11: The rendering process listens to the main process and receives the returned message through window.bridge opened by the preloading process, and then completes the business processing.
[0037] The present invention uses node to call a shell script to conveniently query real-time logs on a device and export historical logs in a windows application; the process includes the following programs:
[0038] Message sending program: The rendering process uses IPC to send a message to the preloading process, and the preloading process sends a message to the main process through ipcRenderer.invoke;
[0039] Message listening program: The main process listens to the message sent by the preloading process by calling ipcMain.handle;
[0040] Process handling program: The main process determines which log operation to adopt. When querying real-time logs, create a WS client to implement the query of real-time logs through full-duplex communication; when querying historical logs, call the device application program interface to query the log information for the corresponding time period;
[0041] Message Return Program: The log service port returns the queried device logs. After the main process receives the returned information, it returns the processed structure to the preloading process, and then transfers it to the rendering process through the preloading process.
[0042] Device Application Program: Provides business interfaces to respond to calls from the main process, sends retrieval requests to the log service port according to the called interfaces, and finally sends the retrieved data to the main process; when querying real-time logs, creates a WS server and realizes the push of real-time logs to the WS client through full-duplex communication; when querying historical logs, calls the log service interface to query the log information for the corresponding time period;
[0043] Log Service Port: It is mainly used to store service logs in the device disk and record the log time; provides an interface for users to directly export the logs during the fault occurrence period for easy problem troubleshooting by users; when performing the log export operation, it queries the corresponding log information and returns the original log information according to the time stamp of the corresponding period sent by the device application program;
[0044] File Reading and Writing Program: Creates a specified file storage directory. When choosing to export logs, writes the queried log information for the specified period into a json file in the specified directory.
[0045] WS Connection: Refers to the WebSocket connection, which is a technology for realizing two-way communication between a Web browser and a server. WebSocket allows full-duplex communication between the client and the server, that is, both sides can send and receive data simultaneously without the need to re-establish a connection every time like HTTP.
[0046] Advantages of WebSocket:
[0047] 1. Real-time: WebSocket provides a more efficient way for real-time data exchange. Once the connection is established, the client and the server can send information to each other simultaneously.
[0048] 2. Persistent Connection: Based on the TCP protocol, after WebSocket uses a single "handshake" to establish a connection, it can maintain a persistent connection state until one party actively closes the connection.
[0049] 3. Low Latency: Supports long connections and two-way communication, significantly reducing network latency, and is suitable for scenarios that require quick responses, such as online games and real-time notifications.
[0050] 4. Lightweight: Although based on the HTTP protocol, it has its own dedicated protocol, with higher transmission efficiency and smaller header information.
[0051] 5. Compatibility: Widely supported by modern browsers and designated as a standard by W3C and IETF.
[0052] When the present invention performs service log viewing or exporting, the preloading process of IPC calls different log operations to obtain logs by invoking the methods ipc.Renderer.invoke('realLogs') and ipc.Renderer.invoke('historyLogs'), which are divided into real-time log viewing and historical log exporting. In the main process, messages are listened for through ipcMain.handle('realLogs') and ipcMain.handl('historyLogs'). If real-time logs are viewed, a WS connection is established with the device application, and real-time log viewing and the received processed log information are achieved through a two-way channel. The rendering process receives the log information and processes and displays it; if historical logs are exported, the interface of the device application is called to query the logs during the fault occurrence time period, and the queried log information is written into a specified directory file for viewing; this process is called through the windows program interface, avoiding the situation of manually entering incorrect commands and making the format of the exported service logs standardized.
[0053] The present invention mainly realizes the operations of service log viewing and exporting for mining equipment. It achieves the function of real-time log viewing through a long connection established between the WS client established by the main program and the WS server established by the device application, and queries the log content for a specified time period by setting a timestamp. Finally, the log content is written into a local file to achieve the function of historical log exporting; it simplifies complex commands into the page display of a desktop application, greatly reducing the operation difficulty of on-site operation and maintenance. Moreover, it can directly export the service logs for the required time period, which is beneficial for quickly troubleshooting equipment failures, thus effectively improving the working efficiency of mining equipment and having excellent market promotion prospects.
Claims
1. A method for viewing and exporting service logs of mining equipment, characterized in that: It includes the following steps: S1. The rendering process sends message data to the preloading process; S2. After receiving the message data, the preloading process sends the message data to the main program; S3. After the main program monitors the message data, it determines whether to perform an export operation or a viewing operation on the service log according to the requirements of the message data; when performing an export operation on the service log, step S4 is carried out; when performing a viewing operation on the service log, step S7 is carried out; S4. The main program calls the export log interface, converts the service log time period information to be exported into a timestamp and sends it to the device application; S5. The device application calls the log service port to query the historical service log within the timestamp range and returns the log information of the historical service log to the device application; S6. After the device application receives the log information, it converts its format and transmits it to the main program; the main program calls the Node module to write the converted log information into a local json file; then step S8 is carried out; S7. The main program creates a WS client, the WS client establishes a long connection with the WS server established by the device application, the WS server calls the log service port to query the real-time service log and transmits it to the main program through the WS server, and the main program generates real-time log information from the real-time service log; then step S8 is carried out; S8. The main program returns the local json file or real-time log information to the listening event of the preloading process; S9. The rendering process listens through window.bridge opened by the preloading process and receives the returned local json file or real-time log information, thereby completing the service log viewing or export processing operation.
2. The method for viewing and exporting service logs of mining equipment according to claim 1, wherein: In step S1, the rendering process sends message data to the preloading process by calling IPC.
3. The method for viewing and exporting service logs of mining equipment according to claim 1, wherein: In step S2, the preloading process calls the ipcRenderer.invoke module to send the message data to the main program.
4. The method for viewing and exporting service logs of mining equipment according to claim 1, characterized in that: In step S3, the main program monitors the message data sent by the preloading process through the ipcMain.handle module.
5. The method for viewing and exporting service logs of mining equipment according to claim 1, characterized in that: In step S7, the connection established between the WS client and the WS server is full-duplex communication.