Log processing method and computer program product

By setting a switch component in the WeChat applet to control log recording, using the recording component to record and forwarding log data through the sharing component, the problem of high log processing cost and low efficiency is solved, and efficient and low-cost log processing is achieved.

CN120803876APending Publication Date: 2025-10-17SHANGHAI JIDOU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511044043.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

WeChat mini-programs' real-time logs have size limits. Data exceeding a certain size requires a fee to resolve. They record the entire log and cannot be recorded on demand, wasting resources. Retrieving log information recorded in the background is costly, and recording screen or bug videos to demonstrate the problem process also requires high communication costs. Existing log processing methods are costly and inefficient, failing to meet development and testing needs.

Method used

By setting the switch component to control log recording, using the recording component to record the log data of the target program, and processing and forwarding the recorded data through the sharing component, redundant content can be reduced, communication costs can be lowered, and processing efficiency can be improved.

Benefits of technology

It effectively reduces redundant records and communication costs of log processing, improves the efficiency and effectiveness of log processing, and meets the needs of development and testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803876A_ABST
    Figure CN120803876A_ABST
Patent Text Reader

Abstract

The invention provides a log processing method and a computer program product, and relates to the technical field of program development. The method comprises the following steps: controlling an opening record and a closing record through an arranged switch assembly; under the condition that recording is started, recording the uploaded log data of the target program through a set recording component to obtain recorded data; wherein the log data comprises multiple pieces of log information; and processing the recorded data through the set sharing component to obtain shared data, and forwarding the shared data based on the communication interface. According to the application, the behavior of recording the log or not is controlled through the set switch component, and the log data of the uploaded target program is recorded through the set recording component when the recording is started, so that the obtained recorded data is processed through the set sharing component to obtain the forwarded sharing data; the log processing efficiency and effectiveness are effectively improved, so that the program development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of program development, in particular to a log processing method and a computer program product. BACKGROUND

[0002] In the development process of WeChat applet, when the test party finds problems, it usually needs to provide detailed log information to the development party to find problems. However, in the case of multi-party joint testing, it is often inconvenient to synchronize targeted log information, which brings great challenges to the development and testing team.

[0003] At present, the real-time log of WeChat applet has size limit, and data exceeding a certain size will be limited, which needs to be paid to solve, and the recorded is full log, which cannot be recorded on demand, wasting resources, and the log information recorded by the background needs the development and joint debugging of applet developers and servers, and the cost of calling is high, and the process of showing problems needs to record video and open debugging tools, and the test personnel need to use debugging tools, and manual determination of the target of recording is needed, and the communication cost is high. Therefore, the current various processing methods of logs have high processing cost and low efficiency, which cannot meet the current development and testing requirements. SUMMARY

[0004] Therefore, the purpose of the embodiments of the present application is to provide a log processing method and a computer program product to improve the problem of high log processing cost and low efficiency in the prior art.

[0005] In order to solve the above problems, in a first aspect, the embodiments of the present application provide a log processing method, which comprises: controlling the opening and closing of recording through the set switch component; In the case of opening recording, the log data of the uploaded target program is recorded through the set recording component to obtain recording data; wherein the log data includes a plurality of log information; The recording data is processed through the set sharing component to obtain sharing data, and the sharing data is forwarded based on the communication interface.

[0006] In the implementation process, the switch component is set to control the behavior of whether to record the log, and the recording component is set to record the log data of the uploaded target program when the recording is started, effectively reducing the recording of redundant content, reducing the file size of the recorded data, facilitating the processing and troubleshooting of the developer, and in the case of ending the log recording, the sharing component is set to process the recorded data to obtain sharing data, and the sharing data is forwarded based on the corresponding communication interface, effectively reducing the cost of communication based on the data of the developer and improving the efficiency of communication. The log can be recorded and shared through the setting of the plurality of components, effectively improving the efficiency and effectiveness of processing the log, and reducing the processing cost of the log, thereby improving the efficiency of program development and testing based on the log, and meeting the current development and testing needs.

[0007] Optionally, the setting of the switch component comprises: setting a switch variable according to starting recording and stopping recording; determining an array structure for storing the log data; encapsulating the switch variable and the array structure to obtain the switch component.

[0008] In the implementation process, a switch method can be encapsulated as a switch component, and a corresponding switch variable is set to represent the two different control modes of starting recording and stopping recording. The array structure for storing the log data is determined and encapsulated to obtain the switch component capable of controlling the recording switch, effectively improving the efficiency and effectiveness of the switch control.

[0009] Optionally, the switch component is set to control the starting recording and stopping recording, comprising: determining the current value of the switch variable based on the triggering condition of the switch component through the switch component; determining starting recording or stopping recording according to the current value through the switch component.

[0010] In the implementation process, when controlling whether to start recording the log, the current value of the switch variable can be determined through the triggering condition of the switch component, and starting recording or stopping recording can be determined according to the actual condition of the current value. The starting recording or stopping recording can be controlled according to the actual needs of the user, effectively improving the effectiveness of the log recording and reducing redundant data.

[0011] Optionally, the setting of the recording component comprises: determining the input parameter condition when recording according to the log data; According to the preset record type, the input parameter condition is determined; The input parameter condition and the output parameter condition are packaged to obtain the record component.

[0012] In the above implementation process, a record method can be packaged as a record component, the input parameter condition at the time of recording can be determined according to the stored log data, and the corresponding output parameter condition can be determined according to the preset record type. The input parameter condition and the output parameter condition are packaged to obtain the corresponding record component. The stored log data can be recorded, and the effectiveness and efficiency of log recording are improved.

[0013] Optionally, the record data of the uploaded target program is recorded by the set record component to obtain the record data, comprising: The current page stack of the target program is obtained through the record component; The log data is recorded through the record component according to the current page stack, the input parameter condition and the output parameter condition to obtain the record data.

[0014] In the above implementation process, in the case of starting recording, the record component can obtain the current page stack of the target program by extracting the page route, and record the stored log data based on the current page stack, the input parameter condition and the output parameter condition to obtain the corresponding record data. The log data of the target program can be recorded in real time, and the real-time and effectiveness of the record data are effectively improved.

[0015] Optionally, the setting of the sharing component comprises: The creation path of the file is determined based on the file manager and the read-write function; The write thread for writing the record data is determined; The data forwarding interface is determined based on the communication interface corresponding to the target program; The creation path, the write thread and the data forwarding interface are packaged to obtain the sharing component.

[0016] In the above implementation process, a sharing method can be packaged as a sharing component. Based on the file manager and the read-write function, the creation path of the file for storing the record data and the write thread for writing the record data can be determined. In order to realize the sharing function after writing and storing, the data forwarding interface can be determined according to the communication structure corresponding to the target program. The creation path, the write thread and the data forwarding interface are packaged to obtain the sharing component which can write, store and forward data. The sharing component can effectively reduce the time cost and energy cost of users based on data communication, and improve the efficiency of communication.

[0017] Optionally, the sharing component is configured to process the record data to obtain sharing data, and forward the sharing data based on a communication interface. The sharing component is configured to construct a target file based on the creation path. The sharing component is configured to convert the record data into character data in a target format, and write the character data into the target file to obtain the sharing data. The sharing component is configured to forward the sharing data based on the data forwarding interface and the communication interface.

[0018] In the above implementation process, when sharing data, the sharing component can construct a corresponding target file based on a creation path, convert record data into character data in a target format, write the character data into the target file to obtain sharing data, and forward the sharing data based on a data forwarding interface and a communication interface corresponding to the target program to share the sharing data with a corresponding user for communication processing. The record data can be converted, written and forwarded, effectively reducing the storage space and forwarding amount of the sharing data, and further improving the efficiency of data sharing.

[0019] Optionally, the method further comprises: determining a trigger component associated with the switch component, the record component and the sharing component; determining a plug-in hidden switch component for hiding and displaying the trigger component, wherein the plug-in hidden switch component is triggered by a set number of clicks; determining a global plug-in interfacing with the target program in combination with the plug-in hidden switch component and the trigger component.

[0020] In the above implementation process, during the use of multiple different functional components, considering that the existence of the components can affect the normal display, application and data collection of the target program interface, a trigger component associated with the switch component, the record component and the sharing component can be determined, and the working state of each functional component can be controlled by the trigger component. In order to make the trigger component not affect the interface of the target program, a plug-in hidden switch component for hiding and displaying the trigger component can be determined by a set number of motor triggers, and a global plug-in interfacing with the target program can be encapsulated according to the plug-in hidden switch component and the trigger component. The corresponding components can be hidden in the normal use of the target program, reducing the blocking of the interface of the target program caused by the components, and the functional components can be triggered for use by multiple clicks when needed, so as to effectively process the log data without affecting the normal use of the target program.

[0021] Optionally, the method further comprises: determining, by the pre-processing component, a recording type of the recording component according to a recording requirement; storing, by the pre-processing component, the log data of the target program in the case of starting recording; storing, by the pre-processing component, the recording data in the case of starting recording.

[0022] In the above implementation process, in order to set the recording, storage and the like of data, the corresponding pre-processing component can be set to determine the recording type preset in the recording component according to the actual recording requirement before data processing, that is, to preset the recording type of data in advance, and the recording type can be adjusted according to the actual requirement, so that the recording data can meet the recording requirement of the user, and the effectiveness of log recording is improved. Moreover, the pre-processing component can acquire the log data of the target program in the case of starting recording, process the log data, and provide the recording component for recording processing, and the pre-processing component can also store the recording data obtained by recording in the case of starting recording, and provide the sharing component for processing. The data type can be configured and the data storage can be controlled through the pre-processing component, so that the multiple functional components can work efficiently in cooperation.

[0023] In a second aspect, the embodiments of the present application further provide a computer program product, which comprises computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the steps in the method in any one of the above log processing methods.

[0024] To sum up, the embodiments of the present application provide a log processing method and a computer program product. The behavior of whether to record log is controlled through the set switch component, the log data of the uploaded target program is recorded through the set recording component in the case of starting recording, the obtained recording data is processed through the set sharing component to obtain the sharing data for forwarding, the efficiency and effectiveness of processing log are effectively improved, the communication cost in log processing is reduced, and the efficiency of program development is improved. BRIEF DESCRIPTION OF DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and other related drawings can also be obtained by those skilled in the art without creative labor on the premise of not paying.

[0026] Figure 1 A block schematic diagram of an electronic device is provided for embodiments of the present application; Figure 2 A flowchart of a first log processing method is provided for embodiments of the present application; Figure 3 A second log processing method is provided for embodiments of the present application; Figure 4 A detailed flowchart of step S100 is provided for embodiments of the present application; Figure 5 A third log processing method is provided for embodiments of the present application; Figure 6 A detailed flowchart of step S200 is provided for embodiments of the present application; Figure 7 A fourth log processing method is provided for embodiments of the present application; Figure 8 A detailed flowchart of step S300 is provided for embodiments of the present application; Figure 9 A fifth log processing method is provided for embodiments of the present application; Figure 10 A sixth log processing method is provided for embodiments of the present application; Figure 11 A structural schematic diagram of a log processing apparatus is provided for embodiments of the present application.

[0027] Icon: 100-electronic device; 111-memory; 112-storage controller; 113-processor; 114-peripheral interface; 115-input output unit; 116-display unit; 800-log processing apparatus; 810-switch component; 820-recording component; 830-sharing component. DETAILED DESCRIPTION

[0028] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0029] Since the real-time log of the WeChat applet has a size limit, data exceeding a certain size will be limited and need to be paid to solve, and the recorded is full log, which cannot be recorded on demand, wasting resources, and the log information recorded through the background needs the development and joint debugging of the applet developer and the server, and the cost of calling is high, and the process of recording video or bug video is needed to show the problem, which needs to record video and open the debugging tool, and the test personnel need to use the debugging tool, manual determination of the target of recording is needed, and the communication cost is high. Therefore, the current various processing methods of the log have high processing cost and low efficiency, and cannot meet the current development and testing requirements.

[0030] To solve the above problems, the embodiments of the present application provide a log processing method and a computer program product, which control the behavior of whether to record the log through the set switch component, and record the log data of the uploaded target program through the set recording component when the recording is started, so as to process the obtained recording data through the set sharing component to obtain the sharing data for forwarding, effectively improve the efficiency and effectiveness of processing the log, reduce the communication cost during log processing, and improve the efficiency of program development.

[0031] Optionally, the embodiments of the present application provide a log processing method, which is applied to an electronic device, and the electronic device can be a server, a personal computer (PC), a tablet computer, a smart phone, a personal digital assistant (PDA) and the like, which has a logical computing function and can set multiple function components in the electronic device to efficiently process the log.

[0032] Optionally, please refer to Figure 1 , Figure 1 A block schematic diagram of an electronic device is provided for the embodiments of the present application. The electronic device 100 can include a memory 111, a storage controller 112, a processor 113, a peripheral interface 114, an input output unit 115, and a display unit 116. Those skilled in the art can understand that the structure shown is only schematic, and does not limit the structure of the electronic device 100. For example, the electronic device 100 can include more or less components than those shown in Figure 1 , or have a different configuration from Figure 1 . Figure 1

[0033] ​The above-mentioned memory 111, storage controller 112, processor 113, peripheral interface 114, input / output unit 115 and display unit 116 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The above-mentioned processor 113 is used to execute the executable modules stored in the memory.

[0034] The memory 111 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), an electrically erasable programmable read only memory (EEPROM), etc. The memory 111 is used to store programs, and the processor 113 executes the programs after receiving execution instructions. The method executed by the electronic device 100 defined by the processes disclosed in any of the embodiments of the present application can be applied to the processor 113 or implemented by the processor 113.

[0035] The processor 113 can be an integrated circuit chip having a signal processing capability. The processor 113 can be a general purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general purpose processor can be a microprocessor, or any conventional processor, etc.

[0036] The peripheral interface 114 couples various input / output devices to the processor 113 and the memory 111. In some embodiments, the peripheral interface 114, the processor 113 and the storage controller 112 can be implemented in a single chip. In other examples, they can be implemented by independent chips respectively.

[0037] The input / output unit 115 is configured to provide input data for a user. The input / output unit 115 can be, but is not limited to, a mouse, a keyboard, and the like.

[0038] The display unit 116 is configured to provide an interactive interface (e.g., a user operation interface) between the electronic device 100 and the user, or to display image data for the user to refer. In this embodiment, the display unit can be a liquid crystal display or a touch display. If the display unit is a touch display, the touch display can be a capacitive touch screen or a resistive touch screen that supports single-point and multi-point touch operations. The support of single-point and multi-point touch operations means that the touch display can sense a touch operation generated at one or more positions on the touch display at the same time, and transmit the sensed touch operation to the processor for calculation and processing. In this embodiment, the display unit 116 can display various types of data, such as recorded data and shared data.

[0039] The electronic device in this embodiment can be configured to perform each step in each log processing method provided in this embodiment. The implementation process of the log processing method will be described in detail in the following embodiments.

[0040] Please refer to Figure 2 , Figure 2 The flowchart of the first log processing method provided in this embodiment can include steps S200-S400.

[0041] In step S200, the opening and closing of recording are controlled by the set switch component.

[0042] The opening and closing of recording are controlled by the set switch component to start recording when recording is needed and to stop recording when recording is not needed, so as to reduce data redundancy and resource waste caused by full recording.

[0043] In step S300, the log data of the uploaded target program is recorded by the set recording component to obtain recorded data when the recording is started.

[0044] The log data of the uploaded target program is recorded by the set recording component when the recording is started, which effectively reduces the recording of redundant content and the file size of the recorded data, and facilitates the processing and troubleshooting of the developer.

[0045] Optionally, the uploaded log data can include a plurality of log information related to the target program.

[0046] It should be noted that the recorded data can be data recorded in the time range from the start of recording to the stop of recording, that is, data recorded in one recording process.

[0047] In step S400, the recorded data is processed by the set sharing component to obtain sharing data, and the sharing data is forwarded based on the communication interface.

[0048] In the case of stopping recording after starting recording, that is, in the case of ending log recording, the recorded data can be processed by the set sharing component to obtain sharing data, and the sharing data can be forwarded based on the corresponding communication interface, thereby effectively reducing the cost of developers communicating based on data and improving the efficiency of communication.

[0049] It should be noted that when the log is processed, only a plurality of set functional components need to be processed, and the backend does not need to be involved in processing, thereby realizing code non-invasive processing, low processing cost and high efficiency.

[0050] In Figure 2 In the embodiment shown, the log can be recorded and shared by the plurality of set components, thereby effectively improving the efficiency and effectiveness of processing the log and reducing the processing cost of the log, thereby improving the efficiency of program development and testing based on the log, and meeting various development and testing needs at present.

[0051] Optionally, please refer to Figure 3 , Figure 3 The second log processing method provided by the embodiment of the present application can further include steps S511-S513.

[0052] In step S511, a switch variable is set according to starting recording and stopping recording.

[0053] The switch method can be encapsulated as a switch component, and the corresponding switch variable is set to represent the two different control modes of starting recording and stopping recording.

[0054] For example, the switch variable can be isLog, the value corresponding to the start of recording is true, the value corresponding to the stop of recording is false, and the default value of the switch variable is false.

[0055] In step S512, an array structure for storing log data is determined.

[0056] In order to store the uploaded log data for recording, the array structure for storing the log data can be determined, and the array structure can be logData, and the default value is empty.

[0057] Step S513, encapsulating the switch variable and the array structure to obtain a switch component.

[0058] The logFn method obtained by encapsulating the array structure for determining the data storage of the log data can be used as the switch component for controlling the switch of the record.

[0059] In the embodiment shown in Figure 3 In the embodiment shown in

[0060] Optionally, refer to Figure 4 , Figure 4 A detailed flowchart of step S100 is provided for the embodiment of the present application, and step S100 can include steps S110-S120.

[0061] Step S110, determining the current value of the switch variable based on the triggering condition of the switch component through the switch component.

[0062] When controlling whether to start recording the log, the current value of the switch variable can be determined based on the triggering condition of the switch component.

[0063] Optionally, the triggering condition of the switch component can change the current value of the switch variable. For example, when the switch component is not triggered, the current value of the switch variable is false, which means that the recording is closed by default. In this case, the switch component is triggered, and the current value of the switch variable changes from false to true, which means that the recording is opened.

[0064] Step S120, determining whether to open the record or close the record according to the current value through the switch component.

[0065] The switch component can determine whether to open the record or close the record according to the actual condition of the current value.

[0066] Optionally, the switch component is connected with the record component. The opening of the record can control the record component to perform the recording work, and the closing of the record can control the record component to stop the recording work.

[0067] In the embodiment shown in Figure 4 In the embodiment shown in

[0068] Optionally, refer to Figure 5 , Figure 5 The third log processing method provided by the embodiment of the present application can further include steps S521-S523.

[0069] Step S521, according to the log data, determine the input parameter condition at the time of recording.

[0070] Among them, one record method can be encapsulated as a record component, and the input parameter condition at the time of recording is determined according to the stored log data, for example, the input parameter condition can include the data type and type of log data.

[0071] Step S522, according to the preset record type, determine the output parameter condition.

[0072] Among them, considering the diversity of the output parameter object, the corresponding output parameter condition can be determined according to the preset record type, and the output parameter condition can include the type of the output parameter object, the current log content, the current date and time, the current routing path and other data related to the record type.

[0073] Step S523, encapsulate the input parameter condition and the output parameter condition to obtain the record component.

[0074] Among them, the input parameter condition and the output parameter condition can be encapsulated to obtain the record component of the type and content that can record the log.

[0075] In Figure 5 The embodiment shown in the figure can record the stored log data, improve the effectiveness and efficiency of log recording.

[0076] Optionally, please refer to Figure 6 , Figure 6 A detailed flowchart of step S200 is provided for the embodiment of the present application, and step S200 can include steps S210-S220.

[0077] Step S210, obtain the current page stack of the target program through the record component.

[0078] Among them, in the case of starting recording, the record component can obtain the current page stack of the target program by extracting the page routing.

[0079] For example, the current page routing of the target program can be extracted by get Current Pages(), so as to obtain the current page stack of the target program. Taking the target program as a WeChat applet as an example, get Current Pages() is a method for obtaining the current page stack of the applet, and the first element of the array of the extracted current page stack is the home page and the last element is the current page.

[0080] Step S220, record the log data according to the current page stack, the input parameter condition and the output parameter condition through the record component, and obtain the record data.

[0081] The log data stored can be recorded and processed based on the current page stack, the input parameter condition and the output parameter condition to obtain corresponding record data.

[0082] Optionally, the current page stack and the stored log data can be combined as input parameter condition contents, and corresponding multiple types of information based on the output parameter condition can be obtained as record data obtained by recording.

[0083] In Figure 6 In the embodiment shown, the log data of the target program can be recorded and processed in real time, effectively improving the real-time and effectiveness of the record data.

[0084] Optionally, please refer to Figure 7 , Figure 7 The fourth log processing method provided by the embodiment of the present application can further include steps S531-S534.

[0085] Step S531, based on the file manager and the read-write function, determining the creation path of the file.

[0086] Step S532, determining the write thread for writing the record data.

[0087] The sharing method can be encapsulated as a sharing component, and based on the file manager and the read-write function, the creation path of the file for storing the record data and the write thread for writing the record data can be determined.

[0088] For example, taking the target program as a WeChat mini program, the corresponding file manager can be a corresponding application interface, such as wx.get File System Manager(), and the write thread can include an application interface capable of realizing file writing, such as File System Manager.write File. The file system manager object File System Manager provided by the WeChat mini program is obtained and assigned to the variable fs. File System Manager can provide a series of methods for operating files and directories, such as reading, writing, deleting and other functions. The creation path of the file to be written is defined, and the creation path is stored in the variable text Path for subsequent query.

[0089] Step S533, based on the communication interface corresponding to the target program, determining the data forwarding interface.

[0090] Step S534, encapsulating the creation path, the write thread and the data forwarding interface to obtain a sharing component.

[0091] Wherein, in order to realize the sharing function after writing storage, the data forwarding interface can be determined according to the communication structure corresponding to the target program, so as to encapsulate the creation path, write thread and data forwarding interface, and obtain a sharing component capable of writing, storing and forwarding data, so as to share the record data recorded by the user with the WeChat friends or WeChat friends of the enterprise and other objects in need of sharing.

[0092] Optionally, the data forwarding interface can be configured with a variety of function options for the user to configure the forwarding, such as forwarding object selection function, multi-selection function (i.e. selecting multiple forwarding objects), other program forwarding function (such as forwarding from WeChat to QQ, etc.).

[0093] In Figure 7 In the embodiment shown, the sharing component can effectively reduce the time cost and effort cost of the user based on data communication, and improve the efficiency of communication.

[0094] Optionally, please refer to Figure 8 , Figure 8 A detailed flowchart of step S300 is provided for the embodiment of the application, and step S300 can include steps S310-S330.

[0095] Step S310, constructing a target file based on the creation path through the sharing component.

[0096] Wherein, when sharing data, the sharing component can construct a corresponding target file based on the creation path.

[0097] Optionally, the constructed target file can be logdata.txt, which can effectively process the record data in TXT format.

[0098] For example, the file name of the target file can also include date, name and other information to distinguish multiple files.

[0099] Step S320, converting the record data into character data in the target format through the sharing component, and writing the character data into the target file to obtain sharing data.

[0100] Wherein, the record data can be converted into character data in the target format, so as to write the character data into the target file to obtain sharing data.

[0101] Optionally, considering that the record data is in TXT format, in order to further reduce the data amount during forwarding and the storage space required by the file, JSON or other formats can be selected as the target format for conversion processing of the record data.

[0102] For example, the code of the write process can include: const fs = wx.getFileSystemManager() const textPath = `${wx.env.USER_DATA_PATH} / ${this.textName}` try { const res = fs.writeFileSync(textPath, JSON.stringify(wx.logData ||[]), 'utf8'); console.log("---------------writeFileSync", res) } catch (e) { console.error("---------------writeFileSync", e) }; Wherein, optionally, a try...catch block can be set when writing, which is used to capture exceptions that may be thrown during code execution. If an error occurs during code execution, the catch block will capture the error object e and can handle the error. fs.writeFileSync is a synchronous file writing method provided by File System Manager, which can block the current thread until the record data is written. The creation path of the file written from the text Path can be read, and the format and content of the shared data written can be: JSON.stringify(wx.logData || []). wx.logData is a variable that may be defined elsewhere in the code, representing the record data to be written. If wx.logData is undefined or null, the default value [] (an empty array) is used. JSON.stringify is a record data serialization method that serializes the record data into a JSON formatted string, i.e. character data, in order to write the file. 'utf8' is the encoding format of the file, which is UTF-8. const res is the return value of the fs.writeFileSync method. In WeChat applet, the return value of fs.writeFileSync is usually an empty object {} indicating that the operation is successful. If the operation fails, an error object will be thrown.

[0103] Step S330, through the sharing component, based on the data forwarding interface and the communication interface, the sharing data is forwarded.

[0104] The sharing data can be forwarded based on the data forwarding interface and the communication interface corresponding to the target program, so as to share the sharing data with the corresponding user for communication processing.

[0105] Optionally, the user can select the object to be forwarded in the data forwarding interface according to the sharing demand of the user. For example, the WeChat applet can forward the sharing data through the communication interface of WeChat, such as wx.shareFileMessage().

[0106] In Figure 8 In the embodiment shown, the recording data can be converted in format before being written and forwarded, effectively reducing the storage space and forwarding amount of the sharing data, and further improving the efficiency of data sharing.

[0107] Optionally, please refer to Figure 9 , Figure 9 The fifth log processing method provided by the embodiment of the present application can further include steps S610-S630.

[0108] Step S610, determine the trigger component associated with the switch component, the recording component and the sharing component.

[0109] In the use process of the plurality of different functional components, considering that the existence of the components will affect the normal display, application and data acquisition of the target program interface, the trigger component associated with the functional components such as the switch component, the recording component and the sharing component can be determined, and the working state of each functional component is controlled by the trigger component.

[0110] Optionally, the trigger component can be set as a corresponding selection menu, and the component to be controlled can be selected in the trigger component.

[0111] Step S620, determine the plug-in hidden switch component for hiding and displaying the trigger component.

[0112] In order to make the trigger component not affect the interface of the target program, the plug-in hidden switch component for hiding and displaying the trigger component can be determined by setting the number of motor triggers.

[0113] Optionally, the plug-in hidden switch component can be triggered by setting the number of clicks, for example, the trigger component is arranged at the upper right corner of the picture, and the trigger component is hidden under normal circumstances, which does not affect the overall display and normal use of the picture, improves the visual display effect of the page and the visual experience of the user. When the trigger component is needed to control the various functional components, more than 5 times of clicking the upper right corner of the picture can display the trigger component, and the user can control the functional components associated with the trigger component according to the own demand. The clicking mode can be determined according to the actual situation, which can be mouse clicking or touch screen clicking.

[0114] Step S630, in combination with the plug-in hidden switch component and the trigger component, the global plug-in connected with the target program is determined.

[0115] Among them, the global plug-in connected with the target program can be packaged according to the plug-in hidden switch component and the trigger component.

[0116] Optionally, the packaging process of the global plug-in can include: packaging a component CommonLog, the page layer is divided into two parts, one part is the current component function, that is, the plug-in hidden switch component, and the other part is the slot of the target program, that is, the trigger component. For the current component function, the outer layer is a view with a click event catchtap method addTimes, addTimes method is clicking, that is, increasing 1, and when the number of clicks reaches a certain number (such as 5 times), the hidden trigger component can appear on the page.

[0117] In Figure 9 In the embodiment shown, the corresponding component can be hidden under the condition that the target program is normally used, the occlusion of the component to the interface of the target program is reduced, and the function component is triggered for use in the case of needing the function component, so that the log data can be effectively processed without affecting the normal use of the target program.

[0118] Optionally, please refer to Figure 10 , Figure 10 The sixth log processing method provided by the embodiment of the application can further include steps S710-S730.

[0119] Step S710, by setting the pre-processing component, the recording type of the recording component is determined according to the recording requirement.

[0120] Wherein, in order to set the record, storage, etc. of data, the corresponding preprocessing component can be set to determine the preset record type in the record component according to the actual record requirement before data processing, that is, to preset the record type of data in advance, and to adjust the record type according to the actual requirement, so that the recorded data can meet the record requirement of the user, and improve the effectiveness of log record.

[0121] Optionally, the record type can be the content of the log that needs to be recorded, such as console.log (output normal log information), console.error (output error information), console.info (output prompt information), etc.

[0122] Step S720, through the preprocessing component, in the case of starting recording, the log data of the target program is obtained, and the log data is stored.

[0123] Step S730, through the preprocessing component, in the case of starting recording, the record data is stored.

[0124] Wherein, the preprocessing component can also obtain the log data of the target program in the case of starting recording, process the log data for record processing by the record component, and store the record data obtained by recording in the case of starting recording for processing by the sharing component.

[0125] Optionally, other functions of data storage can be realized on the basis of the functions of the original multiple function components through rewriting. Since the content of the log is the content printed based on the record type, rewriting this method can make the multiple function components run normally on the one hand, and realize other functions on the other hand. When the log needs to be recorded, that is, when isLog is true, the corresponding type of content can be added to the array structure that needs to be uploaded, that is, added to logdata, and if isLog is started, the record data recorded by the record component is called and added to logData for subsequent processing. If it is closed, it does not need to be processed, and the corresponding information can be directly printed according to the original execution mode.

[0126] In Figure 10 In the embodiment shown, the data type can be configured by the set preprocessing component to control data storage, so that multiple function components can work efficiently in cooperation.

[0127] Please refer to Figure 11 , Figure 11A structural schematic diagram of a log processing apparatus provided by an embodiment of the present application is shown in the figure, wherein the log processing apparatus 800 comprises a switch component 810, a recording component 820 and a sharing component 830.

[0128] The switch component 810 is configured to control the starting of recording and the stopping of recording. In the case of starting of recording, the recording component 820 is configured to record log data of an uploaded target program to obtain recorded data, wherein the log data comprises a plurality of pieces of log information. The sharing component 830 is configured to process the recorded data to obtain shared data and forward the shared data based on a communication interface.

[0129] In an optional implementation, the switch component 810 is configured to: set a switch variable according to the starting of recording and the stopping of recording; determine an array structure for storing the log data; and encapsulate the switch variable and the array structure to obtain the switch component 810.

[0130] In an optional implementation, the switch component 810 is specifically configured to: determine a current value of the switch variable based on a triggering condition of the switch component 810; and determine the starting of recording or the stopping of recording according to the current value.

[0131] In an optional implementation, the recording component 820 is configured to: determine an input parameter condition for recording according to the log data; determine an output parameter condition according to a preset recording type; and encapsulate the input parameter condition and the output parameter condition to obtain the recording component 820.

[0132] In an optional implementation, the recording component 820 is specifically configured to: obtain a current page stack of the target program; and record the log data according to the current page stack, the input parameter condition and the output parameter condition to obtain the recorded data.

[0133] In an optional implementation, the sharing component 830 is configured to: determine a creation path of a file based on a file manager and a read-write function; determine a write thread for writing the recorded data; determine a data forwarding interface based on a communication interface corresponding to the target program; and encapsulate the creation path, the write thread and the data forwarding interface to obtain the sharing component 830.

[0134] In an optional implementation, the sharing component 830 is specifically configured to: construct a target file based on the creation path; convert the recorded data into character data in a target format and write the character data into the target file to obtain the shared data; and forward the shared data based on the data forwarding interface and the communication interface.

[0135] In an optional embodiment, the log processing apparatus 800 can further comprise a trigger component associated with the switch component 810, the recording component 820 and the sharing component 830, a plug-in hidden switch component 810 for hiding and displaying the trigger component; wherein the plug-in hidden switch component 810 is triggered by setting the number of clicks; in combination with the plug-in hidden switch component 810 and the trigger component, the global plug-in connected with the target program is determined.

[0136] In an optional embodiment, the log processing apparatus 800 can further comprise a pre-processing component, the pre-processing component is used to determine the recording type of the recording component 820 according to the recording requirement; in the case of starting recording, the log data of the target program is acquired and stored; in the case of starting recording, the recording data is stored.

[0137] Since the log processing apparatus 800 in the embodiments of the present application has similar problem solving principles as the foregoing embodiments of the log processing method, the implementation of the log processing apparatus 800 in the embodiments can refer to the description in the foregoing embodiments of the log processing method, and the repeated parts will not be described herein.

[0138] The embodiments of the present application further provide a computer program product, the computer program product comprises computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the steps in any one of the log processing methods provided by the embodiments of the present application.

[0139] In several embodiments provided in the present application, it should be understood that the disclosed devices can also be implemented by other manners. The device embodiments described above are only schematic, for example, the block diagram in the drawings shows the possible implementation architecture, function and operation of the device according to the embodiments of the present application. In this regard, each block in the block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders from those described in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram, and the combination of the block diagram, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0140] In addition, each functional module in the embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0141] The functions described can be implemented in hardware, software, firmware or any combination thereof. If implemented in software, the functions can be stored or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media include both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage medium can be any available medium that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code means in the form of instructions or data structures and that can be accessed by a general-purpose or special-purpose computer, or a general-purpose or special-purpose processor. Also, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or other

[0142] The application has been described in an embodiment, and is not intended to limit the scope of the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the scope of the application. It should be noted that similar reference numbers and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.

[0143] The application has been described in an embodiment, and is not intended to limit the scope of the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the scope of the application. It should be noted that similar reference numbers and letters represent similar items in the following drawings, and thus, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings.

[0144] It should be noted that the relational terms herein such as first and second and the like are used solely to distinguish one from another entity or action without necessarily requiring or implying that the entities or actions are in any way actually related or ordered other than by the context of use. Furthermore, the terms "comprise", "comprises", "comprising", "include", "includes" or "including" are intended to encompass non-exclusive inclusions such that a process, method, article, or apparatus that comprises, includes, or includes elements or steps that are not expressly listed is not excluded from the scope of the process, method, article, or apparatus. Without limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements other than the one preceeded by "comprises... a".

Claims

1. A log processing method, characterized in that: The method comprises: Control the opening and closing of recording through the set switch component; When recording is enabled, the uploaded log data of the target program is recorded by the set recording component to obtain recorded data; wherein the log data includes multiple log information; The recorded data is processed by the provided sharing component to obtain shared data, and the shared data is forwarded based on the communication interface.

2. The method according to claim 1, characterized in that in, The configuration of the switch assembly includes: Set the switch variable according to opening and closing records; Determining an array structure for storing the log data; The switch variable and the array structure are encapsulated to obtain the switch component.

3. The method according to claim 2, characterized in that The switch component is provided to control the opening and closing of recording, including: determining, by the switch component, a current value of the switch variable based on a triggering condition of the switch component; Through the switch component, it is determined whether to turn on or off recording according to the current value.

4. The method according to claim 1, wherein in, The settings of the recording component include: Determine the input conditions for recording based on the log data; Determine the parameter conditions according to the preset record type; The input parameter condition and the output parameter condition are encapsulated to obtain the record component.

5. The method according to claim 4, characterized in that The recording component is set to record the log data of the uploaded target program to obtain the recorded data, including: Obtaining the current page stack of the target program through the recording component; The log data is recorded by the recording component according to the current page stack, the input parameter condition and the output parameter condition to obtain the recorded data.

6. The method according to claim 1, characterized in that in, The settings of the sharing component include: Determine the file creation path based on the file manager and read and write functions; Determining a write thread for writing the record data; Determining a data forwarding interface based on the communication interface corresponding to the target program; The creation path, the writing thread, and the data forwarding interface are encapsulated to obtain the sharing component.

7. The method according to claim 6, characterized in that The sharing component is configured to process the recorded data to obtain shared data, and forward the shared data based on a communication interface, including: Building a target file based on the creation path through the sharing component; The sharing component converts the recorded data into character data in a target format, and writes the character data into the target file to obtain the shared data; The shared data is forwarded through the sharing component based on the data forwarding interface and the communication interface.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: determining a trigger component associated with the switch component, the recording component, and the sharing component; Determining a plug-in hidden switch component for hiding and displaying the trigger component; wherein the plug-in hidden switch component is triggered by a set number of clicks; The plug-in hiding switch component and the trigger component are combined to determine a global plug-in that is connected to the target program.

9. The method according to any one of claims 1 to 7, characterized in that The method further comprises: Determining the recording type of the recording component according to the recording requirements through the set preprocessing component; Obtaining the log data of the target program through the preprocessing component with recording enabled, and storing the log data; The pre-processing component stores the recorded data when recording is turned on.

10. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps in the method according to any one of claims 1 to 9 are implemented.