Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
omigo committed Feb 15, 2016
2 parents c37a87e + a8e813d commit 52d6b74
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ _testmain.go
*.test
*.prof

.DS_Store

/tmp/
/logs/
/test/test.log
Expand Down
14 changes: 14 additions & 0 deletions examples/color.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import "github.com/gotips/log"

func execColorizedExamples() {
log.SetLevel(log.AllLevel)
log.Info("default config")

log.Colorized(true)
log.Info("colorized config")

log.Colorized(false)
log.Error("close colorized config")
}
3 changes: 3 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ func main() {
// 源码文件名和行号示例
execSourceFileExamples()

// 日志着色
execColorizedExamples()

// 改变输出位置示例
execChangeWriterExample()

Expand Down
2 changes: 2 additions & 0 deletions standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func (s *Standard) Colorized(c bool) {
return
}

s.colorized = c

s.mu.Lock()
defer s.mu.Unlock()

Expand Down
1 change: 1 addition & 0 deletions test/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package test

0 comments on commit 52d6b74

Please sign in to comment.