diff --git a/gokit.go b/gokit.go index 47c6f89..efa86f4 100644 --- a/gokit.go +++ b/gokit.go @@ -29,7 +29,7 @@ var ( ) //Level 日志等级 -type Level byte +type Level int const ( Default Level = iota @@ -112,7 +112,7 @@ func write(level Level, msg string) { messageStr := format(level, msg) logWriter.Write(level, messageStr) if alsoStdout { - fmt.Println(messageStr) + fmt.Print(messageStr) } } diff --git a/gokit_test.go b/gokit_test.go index 00d95fe..a3dba25 100644 --- a/gokit_test.go +++ b/gokit_test.go @@ -1,19 +1,20 @@ package logkit import ( + "flag" "fmt" "strconv" "testing" "time" ) -func init() { - Init(SYSLOG, "test", LevelInfo) - -} -func TestGoKit(t *testing.T) { - Init(FIlE, "test", LevelDebug) +func init() { + var l Level + flag.Int("level", int(l) , "l") + flag.Parse() + println(l.Get()) } + func BenchmarkGoKit(b *testing.B) { defer Exit() @@ -53,3 +54,6 @@ func TestBuffer(t *testing.T) { Infof("test %s --- %s", "1", "23") //Exit() } + +func TestFlag(t *testing.T) { +}