From 5e845ddad351f9634292dbfe36f34db60c31f73e Mon Sep 17 00:00:00 2001 From: wangruiyu Date: Mon, 29 Jan 2024 16:12:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(main):=20=E4=BF=AE=E5=A4=8D=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=AE=B0=E5=BD=95=E6=97=B6=E9=97=B4=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- knife/logger.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/knife/logger.go b/knife/logger.go index 8d52062..31c98f7 100644 --- a/knife/logger.go +++ b/knife/logger.go @@ -3,6 +3,19 @@ package knife import ( "log" "os" + "time" ) -var Logger = log.New(os.Stdout, "", log.LstdFlags) +var Logger = newLogger() + +type loggers struct { + *log.Logger +} + +func newLogger() *loggers { + now := time.Now().Format("2006-01-02 15:04:05.000") + l := log.New(os.Stdout, now+" ", log.Lshortfile) + return &loggers{ + Logger: l, + } +}