newline in indexHandler log and log all commands

This commit is contained in:
Akbar Rahman 2022-05-26 02:13:59 +01:00
parent f445b14afb
commit aa8c3690ee
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

View File

@ -53,6 +53,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
command := r.PostForm.Get("Command")
shortlink := r.PostForm.Get("Shortlink")
value := r.PostForm.Get("Value")
fmt.Printf("command: %v, shortlink: %v, value: %v\n", command, shortlink, value)
fmt.Println(shortlink)
fmt.Println(value)
@ -79,7 +80,6 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
ctx := context.Background()
_, err := client.Get(ctx, shortlink).Result()
if err == redis.Nil {
fmt.Printf("shortlink: %v, value: %v", shortlink, value)
err = client.Set(ctx, shortlink, value, 0).Err()
if err != nil {