bropkg/engine/logging

    Dark Mode
Search:
Group by:

Types

Level = enum
  lvlInfo, lvlNotice, lvlWarn, lvlError
Log = ref object
  msg: Message
  extraLabel: string
  line, col: int
  useFmt: bool
  args, extraLines: seq[string]
Logger = ref object
  filePath*: string
  infoLogs*, noticeLogs*, warnLogs*, errorLogs*: seq[Log]
Message = enum
  InvalidIndentation = "Invalid indentation",
  UnrecognizedToken = "Unrecognized token",
  UndeclaredVariable = "Undeclared variable",
  AssignUndeclaredVar = "Assigning an undeclared variable",
  MissingAssignmentToken = "Missing assignment token",
  UndeclaredCSSSelector = "Undeclared CSS selector",
  ExtendRedundancyError = "Selector $ extends $ multiple times",
  InvalidProperty = "Invalid CSS property $",
  DuplicateVarDeclaration = "Duplicate variable declaration",
  DuplicateSelector = "Duplicated CSS declaration",
  UnexpectedToken = "Unexpected token",
  UndefinedValueVariable = "Undefined value for variable",
  DeclaredEmptySelector = "Declared CSS selector $ has no properties",
  BadIndentation = "Nestable statement requires indentation",
  UnstablePropertyStatus = "Use of $ is marked as $",
  DuplicateExtendStatement = "Cannot be extended more than once",
  InvalidNestSelector = "Invalid nest for given selector",
  UnknownPseudoClass = "Unknown pseudo-class",
  MissingClosingBracketArray = "Missing closing bracket in array",
  ImportErrorFileNotFound = "Import error file not found",
  InvalidValueCaseStmt = "Invalid value for case statement",
  VariableRedefinition = "Compile-time variables are immutable",
  UndefinedPropertyAccessor = "Undefined property accessor $ for object $",
  InvalidInfixMissingValue = "Invalid infix missing assignable token",
  InvalidInfixOperator = "Invalid infix operator",
  DeclaredVariableUnused = "Declared and not used $", TryingAccessNonObject = "Trying to get property $ on a non-object variable $",
  DuplicateObjectKey = "Duplicate key in object",
  MissingClosingObjectBody = "Missing closing object body",
  InvalidSyntaxCaseStmt = "Invalid syntax for case statement",
  InvalidSyntaxLoopStmt = "Invalid syntax for loop statement",
  InvalidSyntaxCondStmt = "Invalid syntax for conditional statement",
  ConfigLoadingError = "Could not open json config file", InternalError = "$"

Procs

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

Iterators

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

Templates

template error(msg: Message; tk: TokenTuple; args: varargs[string])
template error(msg: Message; tk: TokenTuple; strFmt: bool; args: varargs[string])
template error(msg: Message; tk: TokenTuple; strFmt: bool;
               extraLines: seq[string]; extraLabel: string;
               args: varargs[string])
template warn(msg: Message; tk: TokenTuple; args: varargs[string])
template warn(msg: Message; tk: TokenTuple; strFmt: bool; args: varargs[string])