1
1
mirror of https://tildegit.org/solderpunk/molly-brown synced 2024-09-26 08:40:38 +02:00
molly-brown/logging.go
2019-11-22 21:51:47 +02:00

26 lines
425 B
Go

package main
import (
"net"
"os"
"strconv"
"time"
)
type LogEntry struct {
Time time.Time
RemoteAddr net.Addr
RequestURL string
Status int
}
func writeLogEntry(fp *os.File, entry LogEntry) {
var line string
line = entry.Time.Format(time.RFC3339)
line += "\t" + strconv.Itoa(entry.Status)
line += "\t" + entry.RemoteAddr.String()
line += "\t" + entry.RequestURL
line += "\n"
fp.WriteString(line)
}