newline in indexHandler log and log all commands
This commit is contained in:
parent
f445b14afb
commit
aa8c3690ee
2
main.go
2
main.go
@ -53,6 +53,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
command := r.PostForm.Get("Command")
|
command := r.PostForm.Get("Command")
|
||||||
shortlink := r.PostForm.Get("Shortlink")
|
shortlink := r.PostForm.Get("Shortlink")
|
||||||
value := r.PostForm.Get("Value")
|
value := r.PostForm.Get("Value")
|
||||||
|
fmt.Printf("command: %v, shortlink: %v, value: %v\n", command, shortlink, value)
|
||||||
fmt.Println(shortlink)
|
fmt.Println(shortlink)
|
||||||
fmt.Println(value)
|
fmt.Println(value)
|
||||||
|
|
||||||
@ -79,7 +80,6 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
_, err := client.Get(ctx, shortlink).Result()
|
_, err := client.Get(ctx, shortlink).Result()
|
||||||
if err == redis.Nil {
|
if err == redis.Nil {
|
||||||
fmt.Printf("shortlink: %v, value: %v", shortlink, value)
|
|
||||||
err = client.Set(ctx, shortlink, value, 0).Err()
|
err = client.Set(ctx, shortlink, value, 0).Err()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user