all repos — min @ a67d67c39ccfdcb125ccaa97e750c20de733ac11

A small but practical concatenative programming language.

Added rolling file logger.
h3rald h3rald@h3rald.com
Wed, 09 Nov 2016 12:43:36 +0100
commit

a67d67c39ccfdcb125ccaa97e750c20de733ac11

parent

99b1b316d5c49c3bdbe5b52972b07d7a730d7999

3 files changed, 7 insertions(+), 6 deletions(-)

jump to
M core/consts.nimcore/consts.nim

@@ -46,4 +46,5 @@ HOME = getenv("HOME")

let MINIMRC* = HOME / ".minimrc" let MINIMSYMBOLS* = HOME / ".minim_symbols" -let MINIMHISTORY* = HOME / ".minim_history"+let MINIMHISTORY* = HOME / ".minim_history" +let MINIMLOG* = HOME / "minim.log"
M core/interpreter.nimcore/interpreter.nim

@@ -75,13 +75,13 @@ result.currSym = MinValue(column: 1, line: 1, kind: minSymbol, symVal: "")

proc formatError(sym: MinValue, message: string): string = if sym.filename.isNil or sym.filename == "": - return "$1`: $2" % [sym.symVal, message] + return "[$1]: $2" % [sym.symVal, message] else: - return "$1($2,$3) `$4`: $5" % [sym.filename, $sym.line, $sym.column, sym.symVal, message] + return "$1($2,$3) [$4]: $5" % [sym.filename, $sym.line, $sym.column, sym.symVal, message] proc formatTrace(sym: MinValue): string = if sym.filename.isNil or sym.filename == "": - return " - [native] in symbol: $1" % [sym.symVal] + return " - <native> in symbol: $1" % [sym.symVal] else: return " - $1($2,$3) in symbol: $4" % [sym.filename, $sym.line, $sym.column, sym.symVal]
M minim.nimminim.nim

@@ -38,8 +38,8 @@ min_lang

const PRELUDE* = "prelude.min".slurp.strip -var LOGGER* = newConsoleLogger() -LOGGER.addHandler() +newConsoleLogger().addHandler() +newRollingFileLogger(MINIMLOG, fmtStr = verboseFmtStr).addHandler() proc getExecs(): seq[string] = var res = newSeq[string](0)