diff options
author | Jordan <me@jordan.im> | 2022-11-24 11:15:51 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-11-24 11:15:51 -0700 |
commit | 32b68896d5a1fed17bb9bd18b1b36c3ecd352e27 (patch) | |
tree | d509f23434c9b4ea2797ddb45c836b128aba340f /archive.go | |
parent | ca276b66837ac04bf92de257e5e65d2992f1a547 (diff) | |
download | keep-32b68896d5a1fed17bb9bd18b1b36c3ecd352e27.tar.gz keep-32b68896d5a1fed17bb9bd18b1b36c3ecd352e27.zip |
archive: log /save/ API Message response parameter values; useful info
Diffstat (limited to 'archive.go')
-rw-r--r-- | archive.go | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -22,8 +22,9 @@ var ( ) type Save struct { - URL string `json:"url"` - Job string `json:"job_id"` + URL string `json:"url"` + Job string `json:"job_id"` + Message string `json:"message"` } type Wayback struct { @@ -68,7 +69,7 @@ func isArchived(url string) (bool, int) { return av.Snapshots.Recent.Available, status } -func archive(accessKey string, secretKey string, URL string) (int, string) { +func archive(accessKey string, secretKey string, URL string) (int, string, string) { params := url.Values{} params.Set("url", URL) @@ -85,14 +86,14 @@ func archive(accessKey string, secretKey string, URL string) (int, string) { if e, _ := err.(net.Error); !e.Timeout() { log.Println("SAVE", err) } - return 0, "" + return 0, "", "" } defer resp.Body.Close() save := &Save{} decoder := json.NewDecoder(resp.Body) if err := decoder.Decode(save); err != nil { log.Println("SAVE", err) - return 0, "" + return 0, "", "" } - return resp.StatusCode, save.Job + return resp.StatusCode, save.Job, save.Message } |