remove deprecated log

This commit is contained in:
lealife
2017-11-30 18:46:30 +08:00
parent c6937fd184
commit 094d18be46
16 changed files with 44 additions and 52 deletions

View File

@ -6,21 +6,17 @@ import (
"github.com/revel/revel"
)
func Log(i ...interface{}) {
revel.INFO.Println(i...)
func Log(msg string, i ...interface{}) {
revel.AppLog.Info(msg, i...)
}
func LogW(i ...interface{}) {
revel.WARN.Println(i...)
}
func Log1(key, i interface{}) {
revel.INFO.Println(key, i)
func LogW(msg string, i ...interface{}) {
revel.AppLog.Warn(msg, i...)
}
func LogJ(i interface{}) {
b, _ := json.MarshalIndent(i, "", " ")
revel.INFO.Println(string(b))
revel.AppLog.Info(string(b))
}
// 为test用

View File

@ -79,7 +79,6 @@ func SendEmailOld(to, subject, body string) bool {
err := smtp.SendMail(host+":"+port, auth, username, send_to, msg)
if err != nil {
Log(err)
return false
}
return true

View File

@ -183,7 +183,6 @@ func PutFileStrContent(path, content string) bool {
// Log(path)
if err1 != nil {
Log(err1)
return false
}
return true

View File

@ -400,9 +400,6 @@ func FixFilename(filename string) string {
func IsValidTime(t time.Time) bool {
if t.Year() > 20 {
now := time.Now()
Log("------")
Log(t)
Log(now)
if t.Before(now) {
return true
}

View File

@ -178,13 +178,13 @@ func init() {
func I18nFilter(c *revel.Controller, fc []revel.Filter) {
if foundCookie, cookieValue := hasLocaleCookie(c.Request); foundCookie {
revel.TRACE.Printf("Found locale cookie value: %s", cookieValue)
// revel.TRACE.Printf("Found locale cookie value: %s", cookieValue)
setCurrentLocaleControllerArguments(c, cookieValue)
} else if foundHeader, headerValue := hasAcceptLanguageHeader(c.Request); foundHeader {
revel.TRACE.Printf("Found Accept-Language header value: %s", headerValue)
// revel.TRACE.Printf("Found Accept-Language header value: %s", headerValue)
setCurrentLocaleControllerArguments(c, headerValue)
} else {
revel.TRACE.Println("Unable to find locale in cookie or header, using empty string")
// revel.TRACE.Println("Unable to find locale in cookie or header, using empty string")
setCurrentLocaleControllerArguments(c, "")
}
fc[0](c, fc[1:])
@ -215,7 +215,7 @@ func hasLocaleCookie(request *revel.Request) (bool, string) {
if cookie, error := request.Cookie(name); error == nil {
return true, cookie.GetValue()
} else {
revel.TRACE.Printf("Unable to read locale cookie with name '%s': %s", name, error.Error())
// revel.TRACE.Printf("Unable to read locale cookie with name '%s': %s", name, error.Error())
}
}

View File

@ -53,7 +53,6 @@ func WriteUrl(url string, toPath string) (length int64, newFilename, path string
func GetContent(url string) (content []byte, err error) {
var resp *http.Response
resp, err = http.Get(url)
Log(err)
if resp != nil && resp.Body != nil {
defer resp.Body.Close()
} else {
@ -65,7 +64,6 @@ func GetContent(url string) (content []byte, err error) {
var buf []byte
buf, err = ioutil.ReadAll(resp.Body)
if err != nil {
Log(err)
return
}

View File

@ -3,7 +3,7 @@ package route
import (
"github.com/leanote/leanote/app/db"
"github.com/revel/revel"
. "github.com/leanote/leanote/app/lea"
// . "github.com/leanote/leanote/app/lea"
"net/url"
"strings"
)
@ -25,7 +25,7 @@ func RouterFilter(c *revel.Controller, fc []revel.Filter) {
return
}
Log("---------" + route.Action + " " + path)
// Log("---------" + route.Action + " " + path)
// The route may want to explicitly return a 404.
if route.Action == "404" {