作者 yangfu

console log

  1 +package log
  2 +
  3 +import (
  4 + "log"
  5 +)
  6 +
  7 +type ConsoleLog struct {
  8 +
  9 +}
  10 +
  11 +func newConsoleLog()Log{
  12 + return &ConsoleLog{}
  13 +}
  14 +
  15 +func(this *ConsoleLog)Debug(args ...interface{}){
  16 + //this.log.Debug(args...)
  17 + log.Println(args...)
  18 +}
  19 +
  20 +func(this *ConsoleLog)Info(args ...interface{}){
  21 + log.Println(args...)
  22 +}
  23 +
  24 +func(this *ConsoleLog)Warn(args ...interface{}){
  25 + log.Println(args...)
  26 +}
  27 +
  28 +func(this *ConsoleLog)Error(args ...interface{}){
  29 + log.Println(args...)
  30 +}
  31 +
  32 +func(this *ConsoleLog)Panic(args ...interface{}){
  33 + log.Println(args...)
  34 +}
  35 +
  36 +func(this *ConsoleLog)Fatal(args ...interface{}){
  37 + log.Println(args...)
  38 +}
@@ -12,7 +12,7 @@ type Log interface{ @@ -12,7 +12,7 @@ type Log interface{
12 } 12 }
13 13
14 var( 14 var(
15 - DefaultLog Log 15 + DefaultLog Log =newConsoleLog()
16 ) 16 )
17 17
18 func InitLog(conf config.Logger){ 18 func InitLog(conf config.Logger){
@@ -36,3 +36,4 @@ func Panic(args ...interface{}){ @@ -36,3 +36,4 @@ func Panic(args ...interface{}){
36 func Fatal(args ...interface{}){ 36 func Fatal(args ...interface{}){
37 DefaultLog.Fatal(args...) 37 DefaultLog.Fatal(args...)
38 } 38 }
  39 +
@@ -3,7 +3,6 @@ package mybeego @@ -3,7 +3,6 @@ package mybeego
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 "github.com/astaxie/beego" 5 "github.com/astaxie/beego"
6 - "time"  
7 ) 6 )
8 7
9 //type IMessage interface { 8 //type IMessage interface {
@@ -32,7 +31,7 @@ func NewMessage(code int) *Message { @@ -32,7 +31,7 @@ func NewMessage(code int) *Message {
32 return &Message{ 31 return &Message{
33 Errno: code, 32 Errno: code,
34 Errmsg: ErrnoMsg[code], 33 Errmsg: ErrnoMsg[code],
35 - SysTime: time.Now().Unix(), 34 + //SysTime: time.Now().Unix(),
36 } 35 }
37 } 36 }
38 37