1
0

Added | separator to the start of all log.Printf() to separate date and action.

This commit is contained in:
Alexander Andreev 2023-05-25 02:24:00 +04:00
parent 3327b30d12
commit fccb81d3a5
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -135,7 +135,7 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
typ, _ := utils.NetworkType(r.Host) typ, _ := utils.NetworkType(r.Host)
h.logFile.Printf("up | %s | %s | %s | SHA256 %s | %s | %d | %s", r.Header.Get("X-Real-IP"), typ, h.logFile.Printf("| up | %s | %s | %s | SHA256 %s | %s | %d | %s", r.Header.Get("X-Real-IP"), typ,
fHandler.Filename, fHash, fSaltedHash, fHandler.Size, r.UserAgent()) fHandler.Filename, fHash, fSaltedHash, fHandler.Size, r.UserAgent())
w.WriteHeader(http.StatusCreated) w.WriteHeader(http.StatusCreated)
@ -187,7 +187,7 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
netTyp, _ := utils.NetworkType(r.Host) netTyp, _ := utils.NetworkType(r.Host)
h.logFile.Printf("dw | %s | %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, name, saltedHash, r.UserAgent()) h.logFile.Printf("| dw | %s | %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, name, saltedHash, r.UserAgent())
http.ServeContent(w, r, path, stat.ModTime(), fd) http.ServeContent(w, r, path, stat.ModTime(), fd)
} }
@ -218,7 +218,7 @@ func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) {
netTyp, _ := utils.NetworkType(r.Host) netTyp, _ := utils.NetworkType(r.Host)
h.logFile.Printf("dt | %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, saltedHash, r.UserAgent()) h.logFile.Printf("| dt | %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, saltedHash, r.UserAgent())
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusNoContent)
if strings.Contains(r.UserAgent(), "curl") || strings.Contains(r.UserAgent(), "Wget") { if strings.Contains(r.UserAgent(), "curl") || strings.Contains(r.UserAgent(), "Wget") {