Skip to content

Commit

Permalink
Change log-error to errorf for doc and tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
drewc authored and fare committed Nov 19, 2021
1 parent 6546c19 commit 033180f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
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

0 comments on commit 033180f

Please sign in to comment.