Skip to content

Instantly share code, notes, and snippets.

@srid
Created September 15, 2011 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srid/1220343 to your computer and use it in GitHub Desktop.
Save srid/1220343 to your computer and use it in GitHub Desktop.
(defn parse-log-line
[line]
(next (re-matches #"(\[.+\]) ([^\s]+) \- (\w+ \w+ \w+)\s+(\w+) \-\- (.+)" line)))
(defn play
[]
(let [line "[2011-09-15 11:28:58] dea - 1259 05ed 7573 INFO -- Max Memory set to 4.0G"]
(loop [[x & xs] (parse-log-line line)]
(if x
(do
(println x)
(recur xs))))))
@srid
Copy link
Author

srid commented Sep 15, 2011

best I can come up with:

  (zipmap [:when :component :foo :level :message]
          (next
           (re-matches
            #"(\[.+\]) ([^\s]+) \- (\w+ \w+ \w+)\s+(\w+) \-\- (.+)"
            line)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment