mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Review comments
This commit is contained in:
parent
678eccf33d
commit
f16bb85f9b
@ -38,7 +38,7 @@ func respond(code int, w http.ResponseWriter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func gzipAndSave(data []byte, dirname, fpath string) error {
|
func gzipAndSave(data []byte, dirname, fpath string) error {
|
||||||
_ = os.Mkdir(filepath.Join("bugs", dirname), os.ModePerm)
|
_ = os.MkdirAll(filepath.Join("bugs", dirname), os.ModePerm)
|
||||||
fpath = filepath.Join("bugs", dirname, fpath)
|
fpath = filepath.Join("bugs", dirname, fpath)
|
||||||
|
|
||||||
if _, err := os.Stat(fpath); err == nil {
|
if _, err := os.Stat(fpath); err == nil {
|
||||||
@ -90,7 +90,7 @@ func main() {
|
|||||||
// "bugreport-20170115-112233-1.log.gz" => ...
|
// "bugreport-20170115-112233-1.log.gz" => ...
|
||||||
// "bugreport-20170115-112233-N.log.gz" => oldest log
|
// "bugreport-20170115-112233-N.log.gz" => oldest log
|
||||||
t := time.Now().UTC()
|
t := time.Now().UTC()
|
||||||
prefix := t.Format("bugreport-20060102-150405")
|
prefix := t.Format("2006-01-02/150405")
|
||||||
summary := fmt.Sprintf(
|
summary := fmt.Sprintf(
|
||||||
"%s\n\nNumber of logs: %d\nVersion: %s\nUser-Agent: %s\n", p.Text, len(p.Logs), p.Version, p.UserAgent,
|
"%s\n\nNumber of logs: %d\nVersion: %s\nUser-Agent: %s\n", p.Text, len(p.Logs), p.Version, p.UserAgent,
|
||||||
)
|
)
|
||||||
@ -107,6 +107,9 @@ func main() {
|
|||||||
respond(200, w)
|
respond(200, w)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Make sure bugs directory exists
|
||||||
|
_ = os.Mkdir("bugs", os.ModePerm)
|
||||||
|
|
||||||
port := os.Args[1]
|
port := os.Args[1]
|
||||||
log.Fatal(http.ListenAndServe(":"+port, nil))
|
log.Fatal(http.ListenAndServe(":"+port, nil))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user