Golang Implementing Llog Logs

Source: Internet
Author: User
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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.