Skip to content

Commit

Permalink
Merge branch 'master' of github.com:dearcode/crab
Browse files Browse the repository at this point in the history
  • Loading branch information
c-wind committed Apr 18, 2018
2 parents 565cb85 + cbe1d70 commit 3976b72
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Crab 开发必备库
![Logo](https://raw.githubusercontent.com/dearcode/crab/master/doc/logo.png)
开发 API 必备库


# config
加载ini格式的配置文件, 支持以;或者#开头的注释
Expand Down Expand Up @@ -114,6 +115,5 @@ if err != nil {

```

# validation  
这是从beego复制过来的,改了些东西,这个要重新整理下


25 changes: 15 additions & 10 deletions log/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,38 @@
crab log 是一个轻量级log库,支持不同级别不同颜色输出,按天滚动输出日志文件等常用日志功能

## Example
[![Example Output](doc/log_test.png)](log/log_test.go)
[![Example Output](../doc/log_test.png)](log_test.go)

```go
package log
package main

import (
"testing"
"time"

"github.com/dearcode/crab/log"
)

func TestLog(t *testing.T) {
Debug("default log begin")
Infof("%v test log", time.Now())
func main() {
log.Debug("default log begin")
log.Infof("%v test log", time.Now())

l := NewLogger()
l := log.NewLogger()
l.Debug("logger 1111111111")
l.Info("logger 2222222222")
l.Warningf("logger 33333 %v", time.Now())
l.Errorf("logger color %v xxxxxx", time.Now().UnixNano())

//关闭颜色显示
l.SetColor(false)

l.Errorf("logger no color %v yyyyyy", time.Now().UnixNano())
Infof("%v default has color test log", time.Now())
log.Infof("%v default has color test log", time.Now())

l.SetOutputFile("./vvv.log").SetRolling(true)
//指定输出文件
l.SetOutputFile("./vvv.log").SetRolling(true)
l.Info(time.Now())
}

}
```

## Installing
Expand Down

0 comments on commit 3976b72

Please sign in to comment.