Introduction
=======
BLog4go is an efficient logging library written in the [Go](http://golang.org/) programming language, providing logging hook, log rotate, filtering and formatting log message.
BLog4go 是高性能日志库。创新地使用“边解析边输出”方法进行日志输出,同时支持回调函数、日志淘汰和配置文件。可以解决高并发,调用日志函数频繁的情境下,日志库造成的性能问题。
[![Build Status](https://travis-ci.org/YoungPioneers/blog4go.svg?branch=master)](https://travis-ci.org/YoungPioneers/blog4go)
[![Coverage Status](https://coveralls.io/repos/github/YoungPioneers/blog4go/badge.svg?branch=master)](https://coveralls.io/github/YoungPioneers/blog4go?branch=master)
[![GoDoc](https://godoc.org/github.com/YoungPioneers/blog4go?status.svg)](https://godoc.org/github.com/YoungPioneers/blog4go)
Features
------------------
* *Partially write* to the [bufio.Writer](https://golang.org/pkg/bufio/#Writer) as soon as posible while formatting message to improve performance
* Support different logging output file for different logging level
* Support configure with files in xml format
* Configurable logrotate strategy
* Call user defined hook in asynchronous mode for every logging action
* Adjustable message formatting
* Configurable logging behavier when looging *on the fly* without restarting
* Suit configuration to the environment when logging start
* Try best to get every done in background
* File writer can be configured according to given config file
* Different output writers
* Console writer
* File writer
* Socket writer
Benchmark
------------------
I do some benchmark on a HDD disk comparing amoung fmt,blog4go,seelog,logrus. [Benchmark Code](https://github.com/YoungPioneers/blog4go/tree/master/benchmark)
```
BenchmarkBlog4goSingleGoroutine-4 1000000 1087 ns/op
BenchmarkBlog4goMultiGoroutine-4 30000 56569 ns/op
BenchmarkFmtFormatSingleGoroutine-4 300000 5104 ns/op
BenchmarkFmtFormatWithTimecacheSingleGoroutine-4 300000 4256 ns/op
BenchmarkFmtFormatWithTimecacheMultiGoroutine-4 3000 509579 ns/op
BenchmarkLogrusSingleGoroutine-4 100000 13757 ns/op
BenchmarkLogrusWithTimecacheSingleGoroutine-4 100000 12752 ns/op
BenchmarkLogrusWithTimecacheMultiGoroutine-4 1000 2049809 ns/op
BenchmarkSeelogSingleGoroutine-4 50000 32846 ns/op
BenchmarkSeelogMultiGoroutine-4 1000 3191334 ns/op
```
It shows that blog4go can write log very fast, especially in situation with multi goroutines running at the same time~
Examples
---------------
Full examples please view [EXAMPLES](https://github.com/YoungPioneers/blog4go/tree/master/examples)
Changelog
------------------
[CHANGELOG](https://raw.githubusercontent.com/YoungPioneers/blog4go/master/CHANGELOG)
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传