tim/engine/logging

Search:
Group by:

Types

Level = enum
  lvlInfo, lvlNotice, lvlWarn, lvlError
Log = ref object
  
Logger = ref object
  filePath*: string
  infoLogs*, noticeLogs*, warnLogs*, errorLogs*: seq[Log]
Message = enum
  invalidIndentation = "Invalid indentation [InvalidIndentation]",
  unexpectedToken = "Unexpected token $ [UnexpectedToken]",
  undeclaredVariable = "Undeclared variable $ [UndeclaredVariable]", invalidAccessorStorage = "Invalid accessor storage $ for $ [InvalidAccessorStorage]",
  varRedefine = "Attempt to redefine variable $ [VarRedefine]", varImmutable = "Attempt to reassign value to immutable constant $ [VarImmutable]",
  fnRedefine = "Attempt to redefine function $ [RedefineFunction]",
  fnUndeclared = "Undeclared function $ [UndeclaredFunction]", fnReturnMissingCommand = "Expression $ is of type $ and has to be used or discarded [UseOrDiscard]",
  fnReturnVoid = "Function $ has no return type [VoidFunction]",
  fnExtraArg = "Extra arguments given. Got $ expected $ [ExtraArgs]",
  badIndentation = "Nestable statement requires indentation [BadIndentation]",
  invalidContext = "Invalid $ in this context [InvalidContext]", invalidViewLoader = "Invalid use of `@view` in this context. Use a layout instead [InvalidViewLoader]",
  duplicateViewLoader = "Duplicate `@view` loader [DuplicateViewLoaded]",
  typeMismatch = "Type mismatch. Got $ expected $ [TypeMismatch]",
  duplicateAttribute = "Duplicate HTML attribute $ [DuplicateAttribute]",
  duplicateField = "Duplicate field $ [DuplicateField]",
  undeclaredField = "Undeclared field $ [UndeclaredField]",
  invalidIterator = "Invalid iterator [InvalidIterator]",
  indexDefect = "Index $ not in $ [IndexDefect]",
  importNotFound = "Cannot open file: $ [ImportNotFound]",
  importCircularError = "Circular import detected: $ [CircularImport]",
  eof = "EOF reached before closing $ [EOF]", internalError = "$"

Procs

proc error(logger: Logger; msg: Message; line, col: int; args: openArray[string]) {.
    ...raises: [], tags: [], forbids: [].}
proc getMessage(log: Log): Message {....raises: [], tags: [], forbids: [].}
proc newError(logger: Logger; msg: Message; line, col: int; useFmt: bool;
              args: varargs[string]) {....raises: [], tags: [], forbids: [].}
proc newErrorMultiLines(logger: Logger; msg: Message; line, col: int;
                        useFmt: bool; extraLines: seq[string];
                        extraLabel: string; args: varargs[string]) {....raises: [],
    tags: [], forbids: [].}
proc newInfo(logger: Logger; msg: Message; line, col: int; useFmt: bool;
             args: varargs[string]) {....raises: [], tags: [], forbids: [].}
proc newNotice(logger: Logger; msg: Message; line, col: int; useFmt: bool;
               args: varargs[string]) {....raises: [], tags: [], forbids: [].}
proc newWarn(logger: Logger; msg: Message; line, col: int; useFmt: bool;
             args: varargs[string]) {....raises: [], tags: [], forbids: [].}
proc newWarningMultiLines(logger: Logger; msg: Message; line, col: int;
                          useFmt: bool; extraLines: seq[string];
                          extraLabel: string; args: varargs[string]) {.
    ...raises: [], tags: [], forbids: [].}
proc warn(logger: Logger; msg: Message; line, col: int; args: varargs[string]) {.
    ...raises: [], tags: [], forbids: [].}
proc warn(logger: Logger; msg: Message; line, col: int; strFmt: bool;
          args: varargs[string]) {....raises: [], tags: [], forbids: [].}

Iterators

iterator errors(logger: Logger): Row {....raises: [], tags: [], forbids: [].}
iterator warnings(logger: Logger): Row {....raises: [], tags: [], forbids: [].}

Templates

template compileErrorWithArgs(msg: Message)
template compileErrorWithArgs(msg: Message; args: openArray[string])
template compileErrorWithArgs(msg: Message; args: openArray[string]; meta: Meta)
template compileErrorWithArgs(msg: Message; meta: Meta; args: openArray[string])
template error(msg: Message; meta: Meta; args: varargs[string])
template error(msg: Message; tk: TokenTuple)
template error(msg: Message; tk: TokenTuple; args: openArray[string])
template error(msg: Message; tk: TokenTuple; strFmt: bool;
               extraLines: seq[string]; extraLabel: string;
               args: varargs[string])
template errorWithArgs(msg: Message; tk: TokenTuple; args: openArray[string])
template warn(msg: Message; tk: TokenTuple; args: varargs[string])
template warn(msg: Message; tk: TokenTuple; strFmt: bool; args: varargs[string])
template warnWithArgs(msg: Message; tk: TokenTuple; args: openArray[string])