implements log option (#171)

* implements log option
This commit is contained in:
Andrea Spacca
2018-10-27 00:15:55 +02:00
committed by GitHub
parent 84ee48d8b1
commit 6982590cb0
6 changed files with 74 additions and 51 deletions

View File

@ -27,7 +27,6 @@ package server
import (
"fmt"
"io"
"log"
"net/http"
_ "github.com/PuerkitoBio/ghost/handlers"
@ -44,7 +43,7 @@ func (s *Server) virusTotalHandler(w http.ResponseWriter, r *http.Request) {
contentLength := r.ContentLength
contentType := r.Header.Get("Content-Type")
log.Printf("Submitting to VirusTotal: %s %d %s", filename, contentLength, contentType)
s.logger.Printf("Submitting to VirusTotal: %s %d %s", filename, contentLength, contentType)
vt, err := virustotal.NewVirusTotal(s.VirusTotalKey)
if err != nil {
@ -60,6 +59,6 @@ func (s *Server) virusTotalHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), 500)
}
log.Println(result)
s.logger.Println(result)
w.Write([]byte(fmt.Sprintf("%v\n", result.Permalink)))
}