Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/log-error/errorf for tutorials and docs #641

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/tutorials/kvstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ responding to messages using the `<-` reaction macro:
val)))
(!!value val k))
(catch (e)
(log-error "kvstore.get" e)
(errorf "kvstore.get ~a" e)
(!!error (error-message e) k))))

((!kvstore.ref key k)
Expand All @@ -198,23 +198,23 @@ responding to messages using the `<-` reaction macro:
(!!error "No object associated with key" k)
(!!value val k)))
(catch (e)
(log-error "kvstore.ref" e)
(errorf "kvstore.ref ~a" e)
(!!error (error-message e) k))))

((!kvstore.put! key val k)
(try
(put! key val)
(!!value (void) k)
(catch (e)
(log-error "kvstore.put!" e)
(errorf "kvstore.put! ~a" e)
(!!error (error-message e) k))))

((!kvstore.remove! key k)
(try
(remove! key)
(!!value (void) k)
(catch (e)
(log-error "kvstore.remove!" e)
(errorf "kvstore.remove! ~a" e)
(!!error (error-message e) k))))

(what
Expand Down
12 changes: 6 additions & 6 deletions doc/tutorials/proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ For each connection, it logs it and spawns a thread to proxy it:
(debug "Accepted connection from ~a" (socket-address->string caddr))
(spawn proxy cli raddr)))
(catch (e)
(log-error "Error accepting connection" e))))))
(errorf "Error accepting connection ~a" e))))))
```

### Connection proxying
Expand All @@ -102,7 +102,7 @@ mode.
(spawn proxy-io clisock srvsock)
(spawn proxy-io srvsock clisock)))
(catch (e)
(log-error "Error creating proxy" e))))
(errorf "Error creating proxy ~a" e))))

(def (proxy-io isock osock)
(def buf (make-u8vector 4096))
Expand Down Expand Up @@ -132,7 +132,7 @@ mode.
(lp2 (fx+ start wr)))))
(lp))))))))
(catch (e)
(log-error "Error proxying connection" e)
(errorf "Error proxying connection ~a" e)
(close-input-port isock)
(close-output-port osock))))
```
Expand Down Expand Up @@ -210,7 +210,7 @@ address and then loops accepting connections to proxy:
(debug "Accepted connection from ~a" (socket-address->string sa))
(spawn proxy cli))
(catch (e)
(log-error "Error accepting connection" e))))))
(errorf "Error accepting connection ~a" e))))))
```

### The proxy function
Expand All @@ -223,7 +223,7 @@ This procedure performs a handshake, establishing proxying according to the requ
(spawn proxy-io clisock srvsock)
(spawn proxy-io srvsock clisock))
(catch (e)
(log-error "Error creating proxy" e))))
(errorf "Error creating proxy ~a" e))))
```

The `proxy-handshake` function contains the details of the protocol implementation,
Expand Down Expand Up @@ -335,7 +335,7 @@ through the socket server:
(ssocket-send-all osock buf 0 rd)
(lp)))))
(catch (e)
(log-error "Error proxying connection" e)
(errorf "Error proxying connection ~a" e)
(ssocket-close-input isock)
(ssocket-close-output osock #t))))
```
Expand Down
8 changes: 4 additions & 4 deletions src/tutorial/kvstore/kvstored.ss
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
val)))
(!!value val k))
(catch (e)
(log-error "kvstore.get" e)
(errorf "kvstore.get ~a" e)
(!!error (error-message e) k))))

((!kvstore.ref key k)
Expand All @@ -70,23 +70,23 @@
(!!error "No object associated with key" k)
(!!value val k)))
(catch (e)
(log-error "kvstore.ref" e)
(errorf "kvstore.ref ~a" e)
(!!error (error-message e) k))))

((!kvstore.put! key val k)
(try
(put! key val)
(!!value (void) k)
(catch (e)
(log-error "kvstore.put!" e)
(errorf "kvstore.put! ~a" e)
(!!error (error-message e) k))))

((!kvstore.remove! key k)
(try
(remove! key)
(!!value (void) k)
(catch (e)
(log-error "kvstore.remove!" e)
(errorf "kvstore.remove! ~a" e)
(!!error (error-message e) k))))

(what
Expand Down
6 changes: 3 additions & 3 deletions src/tutorial/proxy/socks-proxy.ss
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
(debug "Accepted connection from ~a" (socket-address->string sa))
(spawn proxy cli))
(catch (e)
(log-error "Error accepting connection" e))))))
(errorf "Error accepting connection ~a" e))))))

(def (proxy clisock)
(try
(let (srvsock (proxy-handshake clisock))
(spawn proxy-io clisock srvsock)
(spawn proxy-io srvsock clisock))
(catch (e)
(log-error "Error creating proxy" e))))
(errorf "Error creating proxy ~a" e))))

;;; SOCKS4
;; Request:
Expand Down Expand Up @@ -144,7 +144,7 @@
(ssocket-send-all osock buf 0 rd)
(lp)))))
(catch (e)
(log-error "Error proxying connection" e)
(errorf "Error proxying connection ~a" e)
(ssocket-close-input isock)
(ssocket-close-output osock #t))))

Expand Down
6 changes: 3 additions & 3 deletions src/tutorial/proxy/tcp-proxy.ss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
(debug "Accepted connection from ~a" (socket-address->string caddr))
(spawn proxy cli raddr)))
(catch (e)
(log-error "Error accepting connection" e))))))
(errorf "Error accepting connection ~a" e))))))

(def (proxy clisock raddr)
(try
Expand All @@ -42,7 +42,7 @@
(spawn proxy-io clisock srvsock)
(spawn proxy-io srvsock clisock)))
(catch (e)
(log-error "Error creating proxy" e))))
(errorf "Error creating proxy ~a" e))))

(def (proxy-io isock osock)
(def buf (make-u8vector 4096))
Expand Down Expand Up @@ -72,7 +72,7 @@
(lp2 (fx+ start wr)))))
(lp))))))))
(catch (e)
(log-error "Error proxying connection" e)
(errorf "Error proxying connection ~a" e)
(close-input-port isock)
(close-output-port osock))))

Expand Down