Created
July 9, 2019 22:38
-
-
Save prismofeverything/09086f8712ca41683ccd27d69f9a8116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn iteration->seq | |
[iteration] | |
(seq | |
(reify java.lang.Iterable | |
(iterator [this] | |
(reify java.util.Iterator | |
(hasNext [this] (.hasNext iteration)) | |
(next [this] (.next iteration)) | |
(remove [this] (.remove iteration))))))) | |
(defn logs-seq | |
"Convert a docker-client ^LogStream to a seq of lines." | |
[logs] | |
(let [it (iteration->seq logs) | |
content (map #(.toString (.decode StandardCharsets/UTF_8 (.content ^LogMessage %))) it)] | |
(mapcat #(string/split % #"\n") content))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment