@@ 5,16 5,20 @@
"Takes a string representing a log line
and returns its message with whitespace trimmed."
[s]
- )
+ (-> s
+ (str/split #":")
+ second
+ str/trim))
(defn log-level
"Takes a string representing a log line
and returns its level in lower-case."
[s]
- )
+ (let [[_ level] (re-find #"^\[(\w+)\]" s)]
+ (str/lower-case level)))
(defn reformat
"Takes a string representing a log line and formats it
with the message first and the log level in parentheses."
[s]
- )
+ (format "%s (%s)" (message s) (log-level s)))