master
guohao 5 years ago
parent e66407395d
commit 0635efeae7
  1. 4
      gokit.go
  2. 14
      gokit_test.go

@ -29,7 +29,7 @@ var (
) )
//Level 日志等级 //Level 日志等级
type Level byte type Level int
const ( const (
Default Level = iota Default Level = iota
@ -112,7 +112,7 @@ func write(level Level, msg string) {
messageStr := format(level, msg) messageStr := format(level, msg)
logWriter.Write(level, messageStr) logWriter.Write(level, messageStr)
if alsoStdout { if alsoStdout {
fmt.Println(messageStr) fmt.Print(messageStr)
} }
} }

@ -1,6 +1,7 @@
package logkit package logkit
import ( import (
"flag"
"fmt" "fmt"
"strconv" "strconv"
"testing" "testing"
@ -8,12 +9,12 @@ import (
) )
func init() { func init() {
Init(SYSLOG, "test", LevelInfo) var l Level
flag.Int("level", int(l) , "l")
} flag.Parse()
func TestGoKit(t *testing.T) { println(l.Get())
Init(FIlE, "test", LevelDebug)
} }
func BenchmarkGoKit(b *testing.B) { func BenchmarkGoKit(b *testing.B) {
defer Exit() defer Exit()
@ -53,3 +54,6 @@ func TestBuffer(t *testing.T) {
Infof("test %s --- %s", "1", "23") Infof("test %s --- %s", "1", "23")
//Exit() //Exit()
} }
func TestFlag(t *testing.T) {
}

Loading…
Cancel
Save