From 749ee84ca3f5a4cdb1d6e749f3e67bf9c1dd9c1e Mon Sep 17 00:00:00 2001 From: hoteas <925970985@qq.com> Date: Sat, 22 Feb 2020 00:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0log=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AD=98=E5=8F=96=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?LOG=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 34 ++++++++++++---------------------- example/main.go | 1 + func.go | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 00f7b55..a52ab9c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,17 +1,10 @@ - + - - - - - - - @@ -188,17 +188,7 @@ - - - - - - file://$PROJECT_DIR$/func.go - 49 - - - + + \ No newline at end of file diff --git a/example/main.go b/example/main.go index c5cb4f3..71d64f4 100644 --- a/example/main.go +++ b/example/main.go @@ -72,6 +72,7 @@ func main() { // // return true //}) + hotime.LogError("dasdasdasdasdas") this.Display(5, "dsadas") }, "websocket": func(this *hotime.Context) { diff --git a/func.go b/func.go index 9e4efad..5fc134b 100644 --- a/func.go +++ b/func.go @@ -29,10 +29,23 @@ import ( // return res //} -func LogFmt(logMsg interface{}, loglevel ...LOG_MODE) { +func LogError(logMsg interface{}) { - logFmt(logMsg, 2, loglevel...) + logFmt(fmt.Sprintln(logMsg), 2, LOG_ERROR) } +func LogWarn(logMsg interface{}) { + + logFmt(fmt.Sprintln(logMsg), 2, LOG_WARN) +} +func LogInfo(logMsg ...interface{}) { + + logFmt(fmt.Sprintln(logMsg), 2, LOG_INFO) +} + +//func LogFmt(logMsg interface{}, loglevel ...LOG_MODE) { +// +// logFmt(logMsg, 2, loglevel...) +//} //日志打印以及存储到文件 func logFmt(logMsg interface{}, printLevel int, loglevel ...LOG_MODE) {