-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
open logfile when init,change adlog.go to utils.go
- Loading branch information
Showing
8 changed files
with
79 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
time="2017-10-20T10:26:58+08:00" level=info msg="test click" adNum=1 appId=1 clickUrl=baidu.com creativeId=456 deviceId=0x22q53 iP=127.0.0.1 oS=1 osVersion=1.0.0 searchId=123 slotId=2 unitId=123 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package utils | ||
import( | ||
"os" | ||
"strconv" | ||
"time" | ||
) | ||
func CheckFileIsExist(filename string) (bool) { | ||
if _, err := os.Stat(filename); os.IsNotExist(err) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
func GetLogFileName(filename,logpath string) string{ | ||
dateStr := strconv.Itoa(time.Now().Year()) + strconv.Itoa(int(time.Now().Month())) + strconv.Itoa(time.Now().Day())+strconv.Itoa(time.Now().Hour()) | ||
var logFileName string | ||
if filename == "impression"{ | ||
logFileName = "impression." + dateStr + ".log" | ||
}else if filename == "click"{ | ||
logFileName = "click." + dateStr + ".log" | ||
}else{ | ||
logFileName = "default." + dateStr + ".log" | ||
} | ||
logFile := logpath + logFileName | ||
return logFile | ||
} |