CN113419773B - Log file generation method and device, electronic equipment, storage medium and product - Google Patents

Log file generation method and device, electronic equipment, storage medium and product Download PDF

Info

Publication number
CN113419773B
CN113419773B CN202110556334.7A CN202110556334A CN113419773B CN 113419773 B CN113419773 B CN 113419773B CN 202110556334 A CN202110556334 A CN 202110556334A CN 113419773 B CN113419773 B CN 113419773B
Authority
CN
China
Prior art keywords
log
code
record data
code submission
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110556334.7A
Other languages
Chinese (zh)
Other versions
CN113419773A (en
Inventor
严子俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202110556334.7A priority Critical patent/CN113419773B/en
Publication of CN113419773A publication Critical patent/CN113419773A/en
Application granted granted Critical
Publication of CN113419773B publication Critical patent/CN113419773B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Library & Information Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a method, an apparatus, an electronic device, a storage medium and a program product for generating a log file, wherein the method comprises the following steps: code submission record data and configuration files are obtained, code submission contents corresponding to the log items are read from the code submission record data, the code submission contents are input into the corresponding log items, and corresponding log titles are added for the log items according to the mapping relation and the code submission types to obtain the log files. The method and the device have the advantages that the configuration file is created in advance, and the log file template is set in the configuration file, so that the fact that the log file can only be generated according to a fixed format is avoided. The code submitted content is input into the corresponding log item, and the corresponding log title is added for the log item, so that the function of automatically generating the log file for common users to view is realized, the repeated refinement of the log content by a developer is avoided, the format design of the log file to be generated by the developer is avoided, and the workload of the developer is reduced.

Description

Log file generation method and device, electronic equipment, storage medium and product
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a method, an apparatus, an electronic device, a computer readable storage medium, and a computer program product for generating a log file.
Background
Currently, in the process of software development, a log file needs to be generated every time software is modified.
In the related art, each generated log file is in a fixed format, and the log file in the fixed format is usually oriented to a developer, so that a record function is provided for the developer. However, it is often desirable to provide log files that prompt for more recent updates to the average user (especially the user of the application client). At this time, the developer needs to refine the log content again according to the existing log file facing the developer, and the developer re-compiles an update log which can be provided for the common user to view, so that the workload of the developer is increased.
Disclosure of Invention
The present disclosure provides a method, an apparatus, an electronic device, a computer readable storage medium, and a computer program product for generating a log file, so as to at least solve the problems of fixed format of the log file in the related art, and the need of a developer to refine the log content again, and increase the workload of the developer. The technical scheme of the present disclosure is as follows:
According to a first aspect of an embodiment of the present disclosure, there is provided a method for generating a log file, including: acquiring code submission record data and a configuration file, wherein the configuration file comprises a log file template, and the log file template comprises log items; reading code submission contents corresponding to the log items from the code submission record data, wherein the configuration file also comprises a mapping relation, the mapping relation represents the association relation between the code submission types of the code submission contents and log titles, and the log titles are used for representing text description information of the code submission types with the association relation in the log items; and inputting the code submitting content into a corresponding log item, and adding a corresponding log title for the log item according to the mapping relation and the code submitting type to obtain a log file.
Optionally, adding a corresponding log header for the log entry according to the mapping relation and the code submission type includes: determining a log title with an association relation with the code submission type according to the mapping relation and the code submission type of the code submission content input in the log item; and adding the determined log title as the log title of the log item.
Optionally, after adding a corresponding log header to the log entry according to the mapping relation and the code submission type, the method further includes: and classifying the log items according to the log titles, and displaying the classified log items in a classified manner.
Optionally, the classifying the log entries according to the log titles and classifying and displaying the classified log entries includes: grouping the log entries having the same log header into the same class; and classifying and displaying the classified log entries according to the priority of the log titles.
Optionally, the acquiring code submission record data includes: and acquiring the code submission record data submitted at the time.
Optionally, the acquiring the code submission record data of the present submission includes: identifying a code submission mark added last time, wherein the code submission mark is used for indicating that the code submission record data is submitted; and taking code submission record data associated with the position corresponding to the code submission mark as the code submission record data submitted at the time.
Optionally, after the log file is obtained, the method further includes: adding a new code commit marker at a location associated with the code commit record data, and taking a location corresponding to the new code commit marker as a starting location of the code commit record data for the next commit.
Optionally, the configuration file further contains location information; after the log file is obtained, the method further comprises: and storing the log file to a position corresponding to the position information.
Optionally, the configuration file further includes account rights corresponding to the log text template; after the log file is obtained, the method further comprises: and transmitting the log file to an application client corresponding to the account authority.
According to a second aspect of the embodiments of the present disclosure, there is provided a log file generating apparatus, including: an acquisition unit configured to perform acquisition of code submission record data and a configuration file, the configuration file containing a log file template containing log entries; a reading unit configured to perform reading of code submission content corresponding to a log item from the code submission record data, the configuration file further including a mapping relationship indicating an association relationship between a code submission type of the code submission content and a log header for indicating text description information of the code submission type having the association relationship with the log header in the log item; and the generating unit is configured to input the code submission content into the corresponding log item, and add a corresponding log title for the log item according to the mapping relation and the code submission type to obtain a log file.
Optionally, the generating unit includes: a log header determination unit configured to perform code submission type of the code submission content input in the log entry according to the mapping relationship, and determine a log header having an association relationship with the code submission type; and a log title adding unit configured to perform addition of the determined log title as a log title of the log item.
Optionally, the apparatus further comprises: the classifying and displaying unit is configured to execute the steps of adding a corresponding log title for the log item according to the mapping relation and the code submitting type by the generating unit, classifying the log item according to the log title, and classifying and displaying the classified log item.
Optionally, the categorizing and displaying unit is configured to perform categorizing the log entries with the same log title into the same category; and classifying and displaying the classified log entries according to the priority of the log titles.
Optionally, the acquiring unit is configured to acquire the code submission record data of the present submission.
Optionally, the acquiring unit includes: a tag identification unit configured to perform identification of a code commit tag added last time, the code commit tag being used to indicate that the code commit record data has been committed; and the data determining unit is configured to execute code submission record data which is associated with the position corresponding to the code submission mark as the code submission record data submitted at the time.
Optionally, the apparatus further comprises: and a mark adding unit configured to perform adding a new code commit mark at a position associated with the code commit record data after the log file is obtained by the generating unit, and taking a position corresponding to the new code commit mark as a start position of code commit record data to be committed next.
Optionally, the configuration file further contains location information; the apparatus further comprises: and a storage unit configured to perform storing the log file to a position corresponding to the position information after the generating unit obtains the log file.
Optionally, the configuration file further includes account rights corresponding to the log text template; the apparatus further comprises: and the transmission unit is configured to transmit the log file to the application client corresponding to the account authority after the generation unit obtains the log file.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method of generating a log file according to the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform the method of generating a log file as described in the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method for generating a log file according to the first aspect described above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the generation scheme of the log file, code submission record data and a configuration file are obtained, wherein the configuration file can comprise a log file template, and the log file template can comprise log items. The code submission record data is read with the code submission content corresponding to the log item, and the configuration file can also contain a mapping relation which represents the association relation between the code submission type of the code submission content and a log title, wherein the log title is used for representing text description information of the code submission type with the association relation in the log item. Inputting the code submitting content into the corresponding log item, and adding the corresponding log title for the log item according to the mapping relation and the code submitting type to obtain the log file. According to the embodiment of the disclosure, the configuration file is created in advance, the log file template of the log file to be generated can be set in the configuration file, the fact that the log file can be generated only according to a fixed format is avoided, and the log text template of any format can be set in the configuration file according to actual needs. The code submitting content is read from the code submitting record data, the code submitting content is input into the corresponding log item, and the corresponding log title is added for the log item, so that the function of automatically generating the log file for common users to view is realized, the secondary refining of the log content by a developer is avoided, the format design of the log file to be generated by the developer is avoided, and the workload of the developer is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a flowchart illustrating a method of generating a log file according to an exemplary embodiment.
FIG. 2 is a schematic diagram illustrating the positional relationship of code commit markers according to an example embodiment.
FIG. 3 is a flow diagram illustrating a dynamic template-based log file generation scheme according to an exemplary embodiment.
Fig. 4 is a block diagram illustrating a log file generating apparatus according to an exemplary embodiment.
FIG. 5 is a block diagram of a log file generating electronic device, according to an example embodiment.
FIG. 6 is a block diagram of an electronic device for generating log files, according to an example embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Fig. 1 is a flowchart illustrating a method of generating a log file, which may be applied to a server that may store and run application code, according to an exemplary embodiment. A developer may modify application code in a server and submit code submission record data to the server using a terminal communicatively coupled to the server. The server may generate code commit record data as a log file. As shown in fig. 1, the method for generating the log file may specifically include the following steps.
In step S11, code submission record data and configuration file are acquired.
In embodiments of the present disclosure, each time a developer modifies an application, the developer needs to submit corresponding code submission record data to the server. Moreover, the code commit record data for each commit may be different from each other. The specific content of the code submission record data may be dependent upon modifications to the application. The code submission record data may indicate what content of the application was modified by the developer. For example, the developer makes a first modification to the application program and submits code submission record data ld1, which code submission record data ld1 may indicate that the developer modified the functional module m1 of the application program. The developer again makes a second modification to the application and submits code submission record data ld2, which code submission record data ld2 may indicate that the developer modified the functional module m2 of the application. The configuration file can be preset and obtained, and the configuration file contains a log file template of the log file to be generated. The log file template may represent a format of a log file, etc., and a specific log file template adopting which format may be determined according to actual situations. In practical applications, the log file template may utilize Handlebars, pug, ejs or the like as a template grammar. Wherein Handlebars is a semantic template library of JavaScript (a lightweight, interpreted or just-in-time compiled high-level programming language with functional preference) that quickly builds web page templates by separating the view components and data. pug and ejs are JavaScript template engines. In addition, the log file template may also use a template grammar customized by a developer, and the embodiment of the disclosure does not specifically limit the type of the template grammar used by the log file template. Moreover, the log file template may contain log entries. Each log entry is used for recording corresponding log content.
In step S12, code commit content corresponding to the log entry is read out from the code commit record data.
In embodiments of the present disclosure, code commit content corresponding to one or more log entries may be included in code commit record data. Code submission content corresponding to the log entry may be marked in the code submission record data by a content identification. In one embodiment, the implementation of determining which log entry the code commit content in the code commit record data corresponds to is: and reading the code submitting content corresponding to the log item from the code submitting record data according to the corresponding relation between the content identifier of the code submitting content and the log identifier of the log item. For example, if the log identifier of the log entry l1 has a correspondence with the content identifier of the code submission content n1, the code submission content n1 corresponding to the log entry l1 is read from the code submission record data.
In step S13, the code submission content is input into the corresponding log entry, and a corresponding log header is added to the log entry according to the mapping relation and the code submission type, so as to obtain a log file.
In embodiments of the present disclosure, the configuration file may further contain a mapping relationship, which may represent an association relationship between a code submission type of the code submission content and a log title. The log header is used to represent text description information of the code submission type having an association relationship therewith in the log entry. In practical applications, the code submission types of the code submission content may include, but are not limited to: add type, delete type, optimize type, repair type, adapt type, etc. The log header of the log entry may include, but is not limited to: function addition, function deletion, function optimization, BUG repair, model adaptation, etc. The mapping relationship may represent an association relationship between an addition type and a function addition, an association relationship between a deletion type and a function deletion, an association relationship between an optimization type and a function optimization, an association relationship between a repair type and a BUG repair, and an association relationship between an adaptation type and a model adaptation. If the code submission type of a certain code submission content D01 is "optimization type", the code submission content D01 is input into the log entry M01, the log header added to the log entry M01 is "function optimization" corresponding to the "optimization type".
According to the generation scheme of the log file, code submission record data and a configuration file are obtained, wherein the configuration file can comprise a log file template, and the log file template can comprise log items. The code submission record data is read with the code submission content corresponding to the log item, and the configuration file can also contain a mapping relation which represents the association relation between the code submission type of the code submission content and a log title, wherein the log title is used for representing text description information of the code submission type with the association relation in the log item. Inputting the code submitting content into the corresponding log item, and adding the corresponding log title for the log item according to the mapping relation and the code submitting type to obtain the log file. According to the embodiment of the disclosure, the configuration file is created in advance, the log file template of the log file to be generated can be set in the configuration file, the fact that the log file can be generated only according to a fixed format is avoided, and the log text template of any format can be set in the configuration file according to actual needs. The code submitting content is read from the code submitting record data, the code submitting content is input into the corresponding log item, and the corresponding log title is added for the log item, so that the function of automatically generating the log file for common users to view is realized, the secondary refining of the log content by a developer is avoided, the format design of the log file to be generated by the developer is avoided, and the workload of the developer is reduced.
In one exemplary embodiment of the present disclosure, a log header having an association relationship with a code submission type may be determined according to a mapping relationship and the code submission type of the code submission content input in the log entry; and adding the determined log title as the log title of the log item. For example, the code submission type of the code submission content D01 input into the log entry M01 is "optimization type", the log header having an association relationship with the code submission type "optimization type" is "function optimization", and then the log header "function optimization" is added as the log header of the log entry M01. Embodiments of the present disclosure may add a corresponding log header to a log entry according to a code submission type and a mapping relationship entered in the log entry. The method has the advantages that the added log title of the log item has an association relationship with the code submission type of the code submission content input in the log item, the code submission type of the code submission content input in the log item is embodied by the log title of the log item, the code submission content in the log item is functionally-layered according to the log title, the reading difficulty of the log file is reduced, and the legibility of the log file is improved.
In an exemplary embodiment of the present disclosure, after adding a corresponding log header to a log entry according to a mapping relationship and a code submission type, the log entry may be further classified according to the log header, and the classified log entry may be classified and displayed. In practical application, the log entries with the same log title can be classified into the same class, and the classified log entries are classified and displayed according to the priority of the log title. For example, the journal of journal item M01 is entitled "functional optimization", the journal of journal item M02 is entitled "BUG repair", the journal of journal item M03 is entitled "functional optimization", the journal of journal item M04 is entitled "BUG repair", and journal of journal item M05 may be categorized as one type, and journal items M01, M03, and M04 may be categorized as one type. And further, displaying the log entries according to the log title, namely, the log entries with the log title of 'functional optimization' are M01, M03 and M04, and the log entries with the log title of 'BUG repair' are M02 and M05. Moreover, the log header "BUG repair" has a higher priority than the log header "functional optimization", and then log entries M02 and M05 may be presented before log entries M01, M03, and M04. According to the embodiment of the disclosure, when the log entries with a plurality of log titles exist, the log entries can be classified according to the log titles, specifically, the log entries with the same log title can be classified into the same class, and then the classified log entries are classified and displayed according to the priority of the log titles. According to the embodiment of the disclosure, the log entries are displayed in a classified manner, so that the log entries in the log information can be clearly displayed, and the definition and the readability of the log file are improved.
In one exemplary embodiment of the present disclosure, when code submission record data is acquired, the latest code submission record data may be acquired, that is, the code submission record data of the present submission may be acquired. The code submission record data submitted at this time is the latest code submission record data. In practical application, the implementation manner of acquiring the latest code submission record data is as follows: the latest code commit marker may be identified, i.e., the last added code commit marker is identified, and the code commit record data associated with the location corresponding to the latest code commit marker is taken as the latest code commit record data. In one embodiment, a developer submits code commit record data to a code repository of a server, which may contain code commit markers in addition to code commit record data. In practical applications, after each time a developer submits code commit record data, a code commit marker is also added at the location where the most recently submitted code commit record data is associated. The code commit marker may be predefined marker information that indicates that code commit record data has been committed and that segments code commit record data for two adjacent commitments. For example, a developer submits code submission record data JL09 in the code repository and adds a code submission flag TJ after the end position of the code submission record data JL09, the developer may also submit the code submission record data JL10 at the position where the code submission flag TJ is associated (e.g., after the position where the code submission flag TJ corresponds). In one embodiment, the implementation of identifying the last added code commit marker is: the code commit mark at the last position in the code warehouse is used as the code commit mark added last time, or the code commit mark with the latest adding time is used as the code commit mark added last time according to the adding time of the code commit mark added each time. Embodiments of the present disclosure do not specifically limit the format, content, etc. of the code commit markers. The embodiment of the disclosure can generate a log file according to the latest code submission record data, namely the code submission record data submitted at the time after each code submission record data is submitted. When code commit record data is committed a plurality of times, code commit record data of two adjacent submissions may be divided according to code commit markers. Therefore, when the code commit record data of the latest commit is acquired, the code commit mark added last time, that is, the latest added code commit mark is identified, and the code commit record data associated with the position corresponding to the latest added code commit mark is taken as the latest code commit record data. The code submitting record data of two adjacent submitting times are separated through the code submitting mark, so that confusion among the code submitting record data submitted for many times is avoided, excessive or insufficient code submitting record data are avoided, the fact that a log file is generated according to the code submitting record data submitted up to date is ensured, and the generated log file is the latest log file.
In one exemplary embodiment of the present disclosure, after obtaining the log file, a new code commit marker may also be added, in particular at a location associated with the latest code commit record data, indicating that the corresponding log file has been generated from the latest code commit record data. For example, a new code commit marker is added at the next paragraph of the latest code commit record data. Moreover, the position corresponding to the new code commit mark may be used as the starting position of the code commit record data of the next commit. For example, as shown in FIG. 2, FIG. 2 shows a schematic diagram of the positional relationship of code commit markers. In the code repository, the paragraph in which the code submission record data C01 is located is paragraph 1. After the log file CL01 is generated according to the code submission record data C01, a code submission flag T01 is added at the next paragraph (paragraph 2) of the code submission record data C01, that is, the paragraph where the code submission flag T01 is located is paragraph 2, the code submission flag T01 may indicate that the code submission record data C01 has generated the corresponding log file CL01, and the next paragraph (paragraph 3) of the code submission flag T01 is the start position of the code submission record data C02 submitted next, and the paragraphs where the code submission record data C02 is located are paragraph 3 and paragraph 4. When the embodiment of the disclosure is used for submitting code submission record data for a plurality of times, after each time a log file is generated, a new code submission mark is added at a position associated with the code submission record data submitted newly, on one hand, the newly added code submission mark is used for indicating that the log file is generated according to the code submission record data submitted newly, and on the other hand, the position corresponding to the newly added code submission mark is used as the starting position of the code submission record data submitted next time. The code submitting record data submitted by two adjacent times is segmented by adding a new code submitting mark, and the code submitting mark is used as the starting position of the code submitting record data submitted each time, so that the code submitting record data submitted for multiple times is prevented from being confused, and the acquisition operation of the code submitting record data is simplified.
In an exemplary embodiment of the present disclosure, the configuration file may further include location information, where the location information may represent a storage location corresponding to the log file. Therefore, after the log file is obtained, the log file may also be stored to a location corresponding to the location information. The location information may represent a storage location of the log file at the server side, or the location information may represent a storage location of the log file at the application client. Moreover, the location information may be set differently for different operating systems. According to the embodiment of the disclosure, the storage positions of the log files can be set in the configuration file, so that the generated log files can be conveniently and uniformly managed, different storage positions can be designated according to actual needs, and the storage space of the log files is optimized.
In an exemplary embodiment of the present disclosure, the configuration file may further include account rights corresponding to the log file template. For example, account rights may be general rights and advanced rights. The configuration file comprises a log file template F corresponding to the common authority and a log file template V corresponding to the advanced authority. The log entries in log file template F may be fewer than the log entries in log file template V. After obtaining the configuration file of the code submission record data, a log file FL01 may be generated for the log file template F, a log file VL01 may be generated for the log file template V, and the generated log file may be transmitted to the application client corresponding to the account authority. The application client corresponding to the account authority may be an application client that logs in an account with the account authority, for example, the account user01 has a common authority, and the account user02 has an advanced authority. The application client FU logged in by the account user01 is an application client corresponding to the common authority, and the application client VU logged in by the account user02 is an application client corresponding to the advanced authority. In the above example, the log file FL01 is transmitted to the application client FU corresponding to the normal authority, and the log file VL01 is transmitted to the application client VU corresponding to the advanced authority. According to the embodiment of the disclosure, the log file templates aiming at different account authorities can be set in the configuration, recorded data is submitted by using codes submitted at the same time, different log files are generated aiming at the log file templates of different account authorities, the generation of differentiated log files is realized, the generated log files are transmitted to corresponding application clients, the user can know the log files of the corresponding account authorities conveniently, and the adaptability of the log files to users of different account authorities is improved.
Based on the above description about an embodiment of a log file generating method, a dynamic template-based log file generating scheme is described below. As shown in fig. 3, a flow diagram of a dynamic template-based log file generation scheme is shown. The scheme can be applied to a server, and a code warehouse is arranged in the server. The developer may submit code commit record data for the application into the code repository. A developer may create a dynamic template (log file template) for an application program that supports Handlebars (a semantic template library).
Step S31, identifying the last added code submitting tag in a code warehouse of the server.
The last added code commit marker is the latest code commit marker. In one embodiment, the latest code submission mark can be determined according to the adding time of the code submission mark existing in the code warehouse, and specifically, the code submission mark with the latest adding time can be used as the last added code submission mark tag.
If a log file exists in the server and a new log file needs to be generated on the basis of the existing log file, the existing log file (changelog 1) can be read out from the server.
Step S32, the latest code submission record data (commit record data) is read from the position corresponding to the code submission mark tag added last time.
The code commit marker tag may be used to segment code commit record data of two adjacent commits. The position corresponding to the last added code submission tag may be the next paragraph or row of the last added code submission tag. Thus, the next paragraph or row of the code commit mark tag added last time reads the code commit record data as the latest code commit record data (commit record data).
In one embodiment, a developer may perform a record read trigger operation for a server after submitting the code to submit the record data. The server reads the latest code submission record data from the code repository in response to the record read trigger operation. Alternatively, the server may actively read the latest code submission record data from the code repository at set periods.
And S33, reading a dynamic template supporting handbars, and generating a log file according to the dynamic template and code submission record data.
In one embodiment, the commit record data and related data of the commit record data may be populated into log entries in the dynamic template, and the dynamic template may be built into a new log file (changelog 2) using handles, which does not include the log file (changelog 1). In another embodiment, the commit record data and related data of the commit record data are filled into log entries of the dynamic template, and the dynamic template is constructed into a new log file (changelog 3) by using Handlebars on the basis of the log file (changelog 1), wherein the log file (changelog 3) comprises the log file (changelog 1). The related data of the commit record data may include, but is not limited to: developer information, remark information, commit time information, and the like.
In one embodiment, a developer may create a configuration file for an application, which may include, but is not limited to: support dynamic templates, mapping relationships, location information, etc. of Handlebars. The mapping relationship represents the association relationship between the code submission type of the code submission content of the commit record data and the log title, and the mapping relationship also represents the association relationship between the information types of the developer information, the remark information, the submission time information and the like and the log title. The above-mentioned log header represents text description information of the code submission type or information type having an association relationship therewith in the log entry. After the log file is generated, the log file may be stored to a location corresponding to the location information. The location corresponding to the location information may be located in a server, or the location corresponding to the location information may be located in another device outside the server.
In step S34, a new code submission flag tag is added at the location associated with the commit record data in the code repository.
After the log file is generated from the latest code submission record data, a new code submission flag tag needs to be added to indicate that the log file has been generated using the latest code submission record data. Moreover, the position corresponding to the newly added code submitting tag can also be used as the starting position of the commit record data of the next submitted code.
It should be noted that, generally, after each step in which a developer submits code submission record data, a corresponding log file may be generated for the code submission record data that is submitted most recently. However, in some scenarios, such as multiple submissions of code submission record data over a short period of time, a corresponding log file may be generated for the code submission record data that was submitted multiple times over a short period of time.
Fig. 4 is a block diagram illustrating a log file generating apparatus according to an exemplary embodiment. The device may comprise in particular the following units.
An acquisition unit 41 configured to execute acquisition of code submission record data and a configuration file including a log file template including log entries;
a reading unit 42 configured to perform reading of code submission content corresponding to a log item from the code submission record data, the configuration file further including a mapping relationship indicating an association relationship between a code submission type of the code submission content and a log header for indicating text description information of the code submission type having the association relationship therewith in the log item;
The generating unit 43 is configured to perform inputting the code submission content into a corresponding log entry, and add a corresponding log header to the log entry according to the mapping relation and the code submission type, so as to obtain a log file.
In an exemplary embodiment of the present disclosure, the generating unit 43 includes:
a log header determination unit configured to perform code submission type of the code submission content input in the log entry according to the mapping relationship, and determine a log header having an association relationship with the code submission type;
and a log title adding unit configured to perform addition of the determined log title as a log title of the log item.
In an exemplary embodiment of the present disclosure, the apparatus further comprises:
and the classifying and displaying unit is configured to perform classification and display on the classified log items according to the log title after the generating unit 43 adds the corresponding log title to the log items according to the mapping relation and the code submission type.
In an exemplary embodiment of the present disclosure, the categorizing presentation unit is configured to perform categorizing log entries having the same log title into the same category; and classifying and displaying the classified log entries according to the priority of the log titles.
In an exemplary embodiment of the present disclosure, the obtaining unit 41 is configured to perform obtaining the code submission record data of the present submission.
In an exemplary embodiment of the present disclosure, the acquiring unit 41 includes:
a tag identification unit configured to perform identification of a code commit tag added last time, the code commit tag being used to indicate that the code commit record data has been committed;
and the data determining unit is configured to execute code submission record data which is associated with the position corresponding to the code submission mark as the code submission record data submitted at the time.
In an exemplary embodiment of the present disclosure, the apparatus further comprises:
a flag adding unit configured to perform adding a new code commit flag at a position associated with the code commit record data after the log file is obtained by the generating unit 43, and taking a position corresponding to the new code commit flag as a start position of code commit record data to be committed next.
In an exemplary embodiment of the present disclosure, the configuration file further contains location information;
The apparatus further comprises:
and a storage unit configured to perform storing the log file to a position corresponding to the position information after the log file is obtained by the generating unit 43.
In an exemplary embodiment of the present disclosure, the configuration file further includes account rights corresponding to the log text template;
the apparatus further comprises:
and a transmission unit configured to perform transmission of the log file to an application client corresponding to the account authority after the generation unit 43 obtains the log file.
The specific manner in which the individual units perform the operations in relation to the apparatus of the above embodiments has been described in detail in relation to the embodiments of the method and will not be described in detail here.
Fig. 5 is a block diagram of a log file generating electronic device 500, according to an example embodiment. For example, electronic device 500 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 5, an electronic device 500 may include one or more of the following components: a processing component 502, a memory 504, a power supply component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the electronic device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the log file generation method described above. Further, the processing component 502 can include one or more modules that facilitate interactions between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
The memory 504 is configured to store various types of data to support operations at the electronic device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phonebook data, messages, images, video, and so forth. The memory 504 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 506 provides power to the various components of the electronic device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 500.
The multimedia component 508 includes a screen between the electronic device 500 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front-facing camera and/or a rear-facing camera. When the electronic device 500 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 further comprises a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 514 includes one or more sensors for providing status assessment of various aspects of the electronic device 500. For example, the sensor assembly 514 may detect an on/off state of the electronic device 500, a relative positioning of components such as a display and keypad of the electronic device 500, a change in position of the electronic device 500 or a component of the electronic device 500, the presence or absence of a user's contact with the electronic device 500, an orientation or acceleration/deceleration of the electronic device 500, and a change in temperature of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the electronic device 500 and other devices, either wired or wireless. The electronic device 500 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 516 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for performing the above-described log file generation method.
In an exemplary embodiment, a computer readable storage medium, such as computer readable memory 504, is also provided, which when executed by processor 520 of electronic device 500, enables electronic device 500 to perform the method of generating a log file described above. Alternatively, the computer readable storage medium may be a non-transitory computer readable storage medium, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, comprising a computer program which, when executed by the processor 520 of the electronic device 500, implements the above-described method of generating a log file. Alternatively, the computer program may be stored in a computer readable storage medium of the electronic device 500, which may be a non-transitory computer readable storage medium, such as a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Fig. 6 is a block diagram illustrating an electronic device 600 for generating log files, according to an example embodiment. For example, the electronic device 600 may be provided as a server. Referring to fig. 6, the electronic device 600 includes a processing component 622 that further includes one or more processors and memory resources represented by a memory 632 for storing instructions, such as application programs, executable by the processing component 622. The application programs stored in memory 632 may include one or more modules each corresponding to a set of instructions. Further, the processing component 622 is configured to execute instructions to perform the method of generating log files described above.
The electronic device 600 may also include a power component 626 configured to perform power management of the electronic device 600, a wired or wireless network interface 650 configured to connect the electronic device 600 to a network, and an input-output (I/O) interface 658. The electronic device 600 may operate based on an operating system stored in the memory 632, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (21)

1. A method for generating a log file, comprising:
acquiring code submission record data and a configuration file, wherein the configuration file comprises a log file template, and the log file template comprises log items;
reading code submission contents corresponding to the log items from the code submission record data, wherein the configuration file also comprises a mapping relation, the mapping relation represents the association relation between the code submission types of the code submission contents and log titles, and the log titles are used for representing text description information of the code submission types with the association relation in the log items;
and inputting the code submitting content into a corresponding log item, and adding a corresponding log title for the log item according to the mapping relation and the code submitting type to obtain a log file.
2. The method of claim 1, wherein adding a corresponding log header to a log entry according to the mapping relationship and the code submission type comprises:
determining a log title with an association relation with the code submission type according to the mapping relation and the code submission type of the code submission content input in the log item;
And adding the determined log title as the log title of the log item.
3. The method of claim 1, wherein after adding a corresponding log header to a log entry according to the mapping relationship and the code submission type, the method further comprises:
and classifying the log items according to the log titles, and displaying the classified log items in a classified manner.
4. A method according to claim 3, wherein classifying the log entries according to the log header and displaying the classified log entries in a classification manner comprises:
grouping the log entries having the same log header into the same class;
and classifying and displaying the classified log entries according to the priority of the log titles.
5. The method of claim 1, wherein the acquiring code commit record data comprises:
and acquiring the code submission record data submitted at the time.
6. The method of claim 5, wherein the obtaining the code commit record data for the current commit comprises:
identifying a code submission mark added last time, wherein the code submission mark is used for indicating that the code submission record data is submitted;
And taking code submission record data associated with the position corresponding to the code submission mark as the code submission record data submitted at the time.
7. The method of claim 6, wherein after the obtaining the log file, the method further comprises:
adding a new code commit marker at a location associated with the code commit record data, and taking a location corresponding to the new code commit marker as a starting location of the code commit record data for the next commit.
8. The method of claim 1, wherein the configuration file further comprises location information;
after the log file is obtained, the method further comprises:
and storing the log file to a position corresponding to the position information.
9. The method of claim 1, wherein the configuration file further comprises account rights corresponding to the log file template;
after the log file is obtained, the method further comprises:
and transmitting the log file to an application client corresponding to the account authority.
10. A log file generating apparatus, comprising:
An acquisition unit configured to perform acquisition of code submission record data and a configuration file, the configuration file containing a log file template containing log entries;
a reading unit configured to perform reading of code submission content corresponding to a log item from the code submission record data, the configuration file further including a mapping relationship indicating an association relationship between a code submission type of the code submission content and a log header for indicating text description information of the code submission type having the association relationship with the log header in the log item;
and the generating unit is configured to input the code submission content into the corresponding log item, and add a corresponding log title for the log item according to the mapping relation and the code submission type to obtain a log file.
11. The apparatus of claim 10, wherein the generating unit comprises:
a log header determination unit configured to perform code submission type of the code submission content input in the log entry according to the mapping relationship, and determine a log header having an association relationship with the code submission type;
And a log title adding unit configured to perform addition of the determined log title as a log title of the log item.
12. The apparatus of claim 10, wherein the apparatus further comprises:
the classifying and displaying unit is configured to execute the steps of adding a corresponding log title for the log item according to the mapping relation and the code submitting type by the generating unit, classifying the log item according to the log title, and classifying and displaying the classified log item.
13. The apparatus according to claim 12, wherein the categorization presentation unit is configured to perform categorizing log entries having the same log title into the same category; and classifying and displaying the classified log entries according to the priority of the log titles.
14. The apparatus of claim 10, wherein the obtaining unit is configured to perform obtaining the code commit record data of the current commit.
15. The apparatus of claim 14, wherein the acquisition unit comprises:
a tag identification unit configured to perform identification of a code commit tag added last time, the code commit tag being used to indicate that the code commit record data has been committed;
And the data determining unit is configured to execute code submission record data which is associated with the position corresponding to the code submission mark as the code submission record data submitted at the time.
16. The apparatus of claim 15, wherein the apparatus further comprises:
and a mark adding unit configured to perform adding a new code commit mark at a position associated with the code commit record data after the log file is obtained by the generating unit, and taking a position corresponding to the new code commit mark as a start position of code commit record data to be committed next.
17. The apparatus of claim 10, wherein the configuration file further comprises location information;
the apparatus further comprises:
and a storage unit configured to perform storing the log file to a position corresponding to the position information after the generating unit obtains the log file.
18. The apparatus of claim 10, wherein the configuration file further comprises account rights corresponding to the log file template;
the apparatus further comprises:
and the transmission unit is configured to transmit the log file to the application client corresponding to the account authority after the generation unit obtains the log file.
19. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of generating a log file as claimed in any one of claims 1 to 9.
20. A computer readable storage medium, characterized in that instructions in the computer readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of generating a log file according to any one of claims 1 to 9.
21. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the method of generating a log file according to any of claims 1 to 9.
CN202110556334.7A 2021-05-21 2021-05-21 Log file generation method and device, electronic equipment, storage medium and product Active CN113419773B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110556334.7A CN113419773B (en) 2021-05-21 2021-05-21 Log file generation method and device, electronic equipment, storage medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110556334.7A CN113419773B (en) 2021-05-21 2021-05-21 Log file generation method and device, electronic equipment, storage medium and product

Publications (2)

Publication Number Publication Date
CN113419773A CN113419773A (en) 2021-09-21
CN113419773B true CN113419773B (en) 2023-11-28

Family

ID=77712714

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110556334.7A Active CN113419773B (en) 2021-05-21 2021-05-21 Log file generation method and device, electronic equipment, storage medium and product

Country Status (1)

Country Link
CN (1) CN113419773B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643904A (en) * 2017-09-18 2018-01-30 泰康保险集团股份有限公司 Code submits detection method, device, medium and the electronic equipment of daily record
CN109359028A (en) * 2018-08-22 2019-02-19 平安科技(深圳)有限公司 Code quality monitoring method, device, computer equipment and storage medium
CN112286894A (en) * 2020-10-29 2021-01-29 云账户技术(天津)有限公司 Log generation method and device and readable storage medium
CN112527618A (en) * 2020-12-17 2021-03-19 中国农业银行股份有限公司 Log collection method and log collection system
CN112527265A (en) * 2019-09-19 2021-03-19 深圳Tcl数字技术有限公司 Method for automatically injecting logs and computer equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130097584A1 (en) * 2011-10-18 2013-04-18 Michal Ayash Mapping software modules to source code
WO2016190876A1 (en) * 2015-05-28 2016-12-01 Hewlett Packard Enterprise Development Lp Dependency rank based on commit history

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643904A (en) * 2017-09-18 2018-01-30 泰康保险集团股份有限公司 Code submits detection method, device, medium and the electronic equipment of daily record
CN109359028A (en) * 2018-08-22 2019-02-19 平安科技(深圳)有限公司 Code quality monitoring method, device, computer equipment and storage medium
CN112527265A (en) * 2019-09-19 2021-03-19 深圳Tcl数字技术有限公司 Method for automatically injecting logs and computer equipment
CN112286894A (en) * 2020-10-29 2021-01-29 云账户技术(天津)有限公司 Log generation method and device and readable storage medium
CN112527618A (en) * 2020-12-17 2021-03-19 中国农业银行股份有限公司 Log collection method and log collection system

Also Published As

Publication number Publication date
CN113419773A (en) 2021-09-21

Similar Documents

Publication Publication Date Title
CN107153541B (en) Browsing interaction processing method and device
CN112131410A (en) Multimedia resource display method, device, system and storage medium
CN110688527A (en) Video recommendation method and device, storage medium and electronic equipment
CN110764627B (en) Input method and device and electronic equipment
CN112528185A (en) Comment information display method and device, server and terminal
CN111046927B (en) Method and device for processing annotation data, electronic equipment and storage medium
CN112000840B (en) Business object display method and device
CN112153218B (en) Page display method and device, wearable device and storage medium
CN112784151B (en) Method and related device for determining recommended information
CN113010157A (en) Code generation method and device
CN109842688B (en) Content recommendation method and device, electronic equipment and storage medium
CN111813932A (en) Text data processing method, text data classification device and readable storage medium
CN113419773B (en) Log file generation method and device, electronic equipment, storage medium and product
CN114466204B (en) Video bullet screen display method and device, electronic equipment and storage medium
CN107368562B (en) Page display method and device and terminal
CN113128181B (en) Information processing method and device
CN112083811B (en) Candidate item display method and device
CN113536180A (en) Item processing method, item processing device, electronic equipment, storage medium and program product
CN112988822A (en) Data query method, device, equipment, readable storage medium and product
CN108427568B (en) User interface updating method and device
CN112416707A (en) Link detection method and device
CN108983992B (en) Candidate item display method and device with punctuation marks
CN106843860B (en) Method, device and system for adjusting display style of search box
CN113946228A (en) Statement recommendation method and device, electronic equipment and readable storage medium
CN112182449A (en) Page loading method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant