Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Commit

Permalink
Set log Prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ink-33 committed May 10, 2020
1 parent ebd346c commit bdff81a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ func getAu(msg string) (au string) {
func au2card(MsgInfo MsgInfo) {
au := getAu(MsgInfo.Message)
if au != "" {
log.Println("BiliAu2Card: Created request for", au, "from:", MsgInfo.SenderID)
log.Println("Created request for", au, "from:", MsgInfo.SenderID)
Auinfo := getAuInfo(au)

if !Auinfo.AuStatus {
msgMake := "BiliAu2Card: AU" + Auinfo.AuNumber + Auinfo.AuMsg
msgMake := "AU" + Auinfo.AuNumber + Auinfo.AuMsg
log.Println(msgMake)
switch MsgInfo.MsgType {
case "private":
Expand All @@ -59,7 +59,7 @@ func au2card(MsgInfo MsgInfo) {
}

} else {
log.Println("BiliAu2Card: Ingore message:", MsgInfo.Message, "from:", MsgInfo.SenderID)
log.Println("Ingore message:", MsgInfo.Message, "from:", MsgInfo.SenderID)
}
}

Expand Down Expand Up @@ -101,10 +101,11 @@ func handleHTTP(w http.ResponseWriter, r *http.Request) {

func main() {
config := readConfig()
log.SetPrefix("BiliAu2Card: ")
path := gjson.Get(config, "BiliAu2Card.0.ListeningPath").String()
port := gjson.Get(config, "BiliAu2Card.0.ListeningPort").String()
log.Println("BiliAu2Card: Powered by Ink33")
log.Println("BiliAu2Card: Start listening", path, port)
log.Println("Powered by Ink33")
log.Println("Start listening", path, port)

http.HandleFunc(path, handleHTTP)
err := http.ListenAndServe(":"+port, nil)
Expand Down

0 comments on commit bdff81a

Please sign in to comment.