From 7f7dd859d18df8a0f4f4e25c2389258e754aca49 Mon Sep 17 00:00:00 2001 From: Jaidyn Levesque Date: Tue, 18 Jun 2019 02:47:06 -0500 Subject: [PATCH] Add log calls --- main.lisp | 31 +++++++++++++++++++++++++++++-- package.lisp | 5 +++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/main.lisp b/main.lisp index 88542e5..9bebca6 100644 --- a/main.lisp +++ b/main.lisp @@ -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 @@ -688,8 +714,9 @@ (uiop:run-program (string+ env "ipfs pubsub pub " topic " \"" string "\"")) nil) +;; ————————————————— -;; NIL → LIST +;; NIL → LIST || (NIL STRING) (defun pubsub-ls () "Return a list of subscribed topics. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-ls" @@ -697,7 +724,7 @@ (ipfs-call "pubsub/ls" '()) (gethash "Strings" result))) -;; [STRING] → LIST +;; [STRING] → LIST || (NIL STRING) (defun pubsub-peers (&optional topic) "Return a list of peers with pubsub enabled. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-peers" diff --git a/package.lisp b/package.lisp index 7b57881..901beec 100644 --- a/package.lisp +++ b/package.lisp @@ -89,6 +89,11 @@ :key-rename :key-remove + ;; log calls + :log-level + :log-ls + :log-tail + ;; pubsub calls :pubsub-sub :pubsub-sub-process