This is a creation in Article, where the information may have evolved or changed.
Golang Implementing Llog Logs
---------------------------
Always want to find a way to practice practiced hand, look at some open source projects when looking at the log related, he also wrote a to practice Golang.
The source code is already on Github, put a link first
Link Address:
Https://github.com/LvanNeo/llog
Git Clone Address:
Https://github.com/LvanNeo/llog.git
Now, about
Llog Implementation Features:
1. The log is divided into 7 levels, as follows:
All
DEBUG
INFO
WARN
ERROR
FATAL
OFF
2. Support output log to console and file.
3. Each level supports two write log functions: string default stitching and custom format stitching.
4. String stitching occurs when the specified log output level is equal to or higher.
5. Support log file name and size setting.
6. Supports separate settings for console and file log output levels.
7. Support XML and JSON format configuration.
8. The log output file can be closed, and the log output console is opened by default.
Llog Log Implementation Method:
Mainly divided into three layers:
Upper layer: Encapsulates the relevant tool method for starting and using logs.
Middle: Encapsulates the core of the log processing.
Bottom: Writes the specific execution of the log. such as: console, file
The bottom and middle layer separation, the use of adapter, each implementation of a new form of log output, only the active to the middle-level log core to submit registration to use the implementation. So it's easy to extend other log output implementations.
---------------------
Added support for JSON format configuration file