Skip to content
Snippets Groups Projects
Commit ae6c5a4e authored by Cam Saul's avatar Cam Saul
Browse files

don't log empty API call bodies. Show the title of an annotation

parent 46883430
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@
<span class="text-grey-3"> added an annotation for </span>
<span class="text-brand">{{getAnnotationTimeframe(annotation)}}</span>
</p>
<p class="text-grey-5">{{annotation.title}}</p>
<p class="text-grey-4">{{annotation.body}}</p>
</div>
</li>
......
......@@ -42,13 +42,13 @@
(defn- log-request [{:keys [uri request-method body]}]
(log/debug (color/blue (format "%s %s " (.toUpperCase (name request-method)) uri)
(when-let [body-output (with-out-str (pprint body))]
(str "\n" body-output)))))
(when (or (string? body) (coll? body))
(str "\n" (with-out-str (pprint body)))))))
(defn- log-response [{:keys [uri request-method]} {:keys [status body]} elapsed-time]
(let [error? (>= status 400)
color-fn (if error? color/red color/green)]
(log/debug (color-fn (format "%s %s %d (%d ms)" (.toUpperCase (name request-method)) uri status elapsed-time)
(when (or error? (not only-display-output-on-error))
(when-let [body-output (with-out-str (pprint body))]
(str "\n" body-output)))))))
(when (or (string? body) (coll? body))
(str "\n" (with-out-str (pprint body)))))))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment