Files
kiss-flixel/src/kiss_flixel/Log.kiss

26 lines
942 B
Plaintext

(defMacro gitVersion [&builder b]
(let [branch
(assertProcess "git" ["rev-parse" "--abbrev-ref" "HEAD"])
commitNum
(assertProcess "git" ["rev-list" "--count" "HEAD"])]
(b.str "${branch}@${commitNum}")))
(function log [:String s]
(#cond
(sys
(#when debug
(Sys.println s))
(let [file (sys.io.File.append logFile false)]
(file.writeString "${s}\n")
(file.close)))
(true
(haxe.Log.trace s))))
// Store the absolute path of the log file in case the program needs to change cwd:
(var &mut logFile "")
(function use []
(set Prelude.printStr log)
(set logFile (joinPath (Sys.getCwd) "log.txt"))
(let [msg "Launching version $(gitVersion) for $(Sys.systemName) on $(.toString (Date.now))"
divider (* msg.length "-")]
(log "${divider}\n${msg}\n${divider}")))