Add log calls

This commit is contained in:
Jaidyn Levesque 2019-06-18 02:47:06 -05:00
parent 43f2c476b0
commit 7f7dd859d1
2 changed files with 34 additions and 2 deletions

View File

@ -639,6 +639,32 @@
;; —————————————————————————————————————
;; LOG CALLS
;; STRING STRING → STRING || (NIL STRING)
(defun log-level (subsystem level)
"Change the logging level of a subsystem.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-log-level"
(bind-api-result
(ipfs-call "log/level" `(("arg" ,subsystem)("arg" ,level)))
(gethash "Message" result)))
;; NIL → LIST || (NIL STRING)
(defun log-ls ()
"List the logging subsystems.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-log-ls"
(bind-api-result (ipfs-call "log/ls" '()) (gethash "Strings" result)))
;; NIL → STRING || (NIL STRING)
(defun log-tail ()
"Read the event log.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-log-tail"
(bind-api-result (ipfs-call "log/tail" '()) result))
;; ————————————————————————————————————— ;; —————————————————————————————————————
;; PUBSUB CALLS ;; PUBSUB CALLS
@ -688,8 +714,9 @@
(uiop:run-program (string+ env "ipfs pubsub pub " topic " \"" string "\"")) (uiop:run-program (string+ env "ipfs pubsub pub " topic " \"" string "\""))
nil) nil)
;; —————————————————
;; NIL → LIST ;; NIL → LIST || (NIL STRING)
(defun pubsub-ls () (defun pubsub-ls ()
"Return a list of subscribed topics. "Return a list of subscribed topics.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-ls" /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-ls"
@ -697,7 +724,7 @@
(ipfs-call "pubsub/ls" '()) (ipfs-call "pubsub/ls" '())
(gethash "Strings" result))) (gethash "Strings" result)))
;; [STRING] → LIST ;; [STRING] → LIST || (NIL STRING)
(defun pubsub-peers (&optional topic) (defun pubsub-peers (&optional topic)
"Return a list of peers with pubsub enabled. "Return a list of peers with pubsub enabled.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-peers" /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-peers"

View File

@ -89,6 +89,11 @@
:key-rename :key-rename
:key-remove :key-remove
;; log calls
:log-level
:log-ls
:log-tail
;; pubsub calls ;; pubsub calls
:pubsub-sub :pubsub-sub
:pubsub-sub-process :pubsub-sub-process