Fix translations and grammar for section "custom log processing with
seelog" in 12.1.md
This commit is contained in:
@@ -36,9 +36,9 @@ Then let's write a simple example:
|
||||
|
||||
Compile and run the program. If you see a `Hello from seelog` in your application log, seelog has been successfully installed and is running operating normally.
|
||||
|
||||
## Based seelog custom log processing
|
||||
## Custom log processing with seelog
|
||||
|
||||
seelog support custom log processing, the following is based on its custom log processing part of the package:
|
||||
Seelog supports custom log processing. The following code snippet is based on the its custom log processing part of its package:
|
||||
|
||||
|
||||
package logs
|
||||
@@ -96,31 +96,33 @@ seelog support custom log processing, the following is based on its custom log p
|
||||
}
|
||||
|
||||
|
||||
Above the main achievement of the three functions,
|
||||
The above implements the three main functions:
|
||||
|
||||
- `DisableLog`
|
||||
|
||||
Logger initialize global variables as seelog disabled state, mainly in order to prevent the Logger was repeatedly initialized
|
||||
Initializes a global variable `Logger` with seelog disabled, mainly in order to prevent the logger from being repeatedly initialized
|
||||
|
||||
- `LoadAppConfig`
|
||||
|
||||
Depending on the configuration file to initialize seelog configuration information, where we read the configuration file by string set up, of course, you can read the XML file. Inside the configuration is as follows:
|
||||
Initializes the configuration settings of seelog according to a configuration file. In our example we are reading the configuration from an in-memory string, but of course, you can read it from an XML file also. Inside the configuration, we set up the following parameters:
|
||||
|
||||
- Seelog
|
||||
|
||||
minlevel parameter is optional, if configured, is higher than or equal to the level of the log will be recorded, empathy maxlevel.
|
||||
The `minlevel` parameter is optional. If configured, logging levels which are greater than or equal to the specified level will be recorded. The optional `maxlevel` parameter is similarly used to configure the maximum logging level desired.
|
||||
|
||||
- Outputs
|
||||
|
||||
Output destination, where data is divided into two, one record to the log rotate file inside. Another set up a filter, if the error level is critical, it will send alarm messages.
|
||||
Configures the output destination. In our particular case, we channel our logging data into two output destinations. The first is a rolling log file where we continuously save the most recent window of logging data. The second destination is a filtered log which records only critical level errors. We additionally configure it to alert us via email when these types of errors occur.
|
||||
|
||||
- Formats
|
||||
|
||||
Log format defines various
|
||||
Defines the various logging formats. You can use custom formatting, or predefined formatting -a full list of predefined formats can be found on seelog's [wiki](https://github.com/cihub/seelog/wiki/Format-reference)
|
||||
|
||||
- `UseLogger`
|
||||
|
||||
Set the current logger for the corresponding log processing
|
||||
Set the current logger as our log processor
|
||||
|
||||
Above we defined a custom log processing package, the following example is to use:
|
||||
Above, we've defined and configured a custom log processing package. The following code demonstrates how we'd use it:
|
||||
|
||||
package main
|
||||
|
||||
|
||||
Reference in New Issue
Block a user