Browse code

Add log calls

Jaidyn Levesque authored on 2019-06-18 07:47:06
Showing 2 changed files
... ...
@@ -639,6 +639,32 @@
639 639
 
640 640
 
641 641
 
642
+;; —————————————————————————————————————
643
+;; LOG CALLS
644
+
645
+;; STRING STRING → STRING || (NIL STRING)
646
+(defun log-level (subsystem level)
647
+  "Change the logging level of a subsystem.
648
+  /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-level"
649
+  (bind-api-result
650
+    (ipfs-call "log/level" `(("arg" ,subsystem)("arg" ,level)))
651
+    (gethash "Message" result)))
652
+
653
+;; NIL → LIST || (NIL STRING)
654
+(defun log-ls ()
655
+  "List the logging subsystems.
656
+  /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-ls"
657
+  (bind-api-result (ipfs-call "log/ls" '()) (gethash "Strings" result)))
658
+
659
+;; NIL → STRING || (NIL STRING)
660
+(defun log-tail ()
661
+  "Read the event log.
662
+  /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-tail"
663
+  (bind-api-result (ipfs-call "log/tail" '()) result))
664
+
665
+
666
+
667
+
642 668
 ;; —————————————————————————————————————
643 669
 ;; PUBSUB CALLS
644 670
 
... ...
@@ -688,8 +714,9 @@
688 714
   (uiop:run-program (string+ env "ipfs pubsub pub " topic " \"" string "\""))
689 715
   nil)
690 716
 
717
+;; —————————————————
691 718
 
692
-;; NIL → LIST
719
+;; NIL → LIST || (NIL STRING)
693 720
 (defun pubsub-ls ()
694 721
   "Return a list of subscribed topics.
695 722
   /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-ls"
... ...
@@ -697,7 +724,7 @@
697 724
     (ipfs-call "pubsub/ls" '())
698 725
     (gethash "Strings" result)))
699 726
 
700
-;; [STRING] → LIST
727
+;; [STRING] → LIST || (NIL STRING)
701 728
 (defun pubsub-peers (&optional topic)
702 729
   "Return a list of peers with pubsub enabled.
703 730
   /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-peers"
... ...
@@ -89,6 +89,11 @@
89 89
     :key-rename
90 90
     :key-remove
91 91
 
92
+    ;; log calls
93
+    :log-level
94
+    :log-ls
95
+    :log-tail
96
+
92 97
     ;; pubsub calls
93 98
     :pubsub-sub
94 99
     :pubsub-sub-process