API reference: chronicles

Types


Procs


getLogThreadId

undefined

proc getLogThreadId(): int {.raises: [], tags: [].}
1

Templates


activeChroniclesScope

undefined

template activeChroniclesScope()
1

logScope

undefined

template logScope(newBindings: untyped) {.dirty.}
1

publicLogScope

undefined

template publicLogScope(newBindings: untyped) {.dirty.}
1

dynamicLogScope

undefined

template dynamicLogScope(stream: type; bindings: varargs[untyped]) {.dirty.}
1

dynamicLogScope

undefined

template dynamicLogScope(bindings: varargs[untyped]) {.dirty.}
1

setTopicState

undefined

template setTopicState(name, state)
1

setLogLevel

undefined

template setLogLevel(name, state)
1

formatItIMPL

undefined

template formatItIMPL(value: any): auto
1

formatIt

undefined

template formatIt(T: type; body: untyped) {.dirty.}
1

expandItIMPL

undefined

template expandItIMPL[R; ](record: R; field: static string; value: any)
1

log

undefined

template log(severity: static[LogLevel]; eventName: static[string];
            props: varargs[untyped]) {.dirty.}
1
2

log

undefined

template log(stream: type; severity: static[LogLevel]; eventName: static[string];
            props: varargs[untyped]) {.dirty.}
1
2

trace

undefined

template trace(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

trace

undefined

template trace(stream: type; eventName: static[string]; props: varargs[untyped]) {.
    dirty.}
1
2

debug

undefined

template debug(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

debug

undefined

template debug(stream: type; eventName: static[string]; props: varargs[untyped]) {.
    dirty.}
1
2

info

undefined

template info(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

info

undefined

template info(stream: type; eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

notice

undefined

template notice(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

notice

undefined

template notice(stream: type; eventName: static[string]; props: varargs[untyped]) {.
    dirty.}
1
2

warn

undefined

template warn(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

warn

undefined

template warn(stream: type; eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

error

undefined

template error(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

error

undefined

template error(stream: type; eventName: static[string]; props: varargs[untyped]) {.
    dirty.}
1
2

fatal

undefined

template fatal(eventName: static[string]; props: varargs[untyped]) {.dirty.}
1

fatal

undefined

template fatal(stream: type; eventName: static[string]; props: varargs[untyped]) {.
    dirty.}
1
2

dynamic_scope

Types


Procs


logAllDynamicProperties

undefined

proc logAllDynamicProperties[LogRecord](stream: typedesc; r: var LogRecord)
1

Templates


dynamic_scope_types

Types

ScopeBindingBase

undefined

ScopeBindingBase[LogRecord] = object of RootObj
  name*: string
  appender*: LogAppender[LogRecord]
1
2
3

LogAppender

undefined

LogAppender[LogRecord] = proc (x: var LogRecord;
                            valueAddr: ptr ScopeBindingBase[LogRecord])
1
2

ScopeBinding

undefined

ScopeBinding[LogRecord; T] = object of ScopeBindingBase[LogRecord]
  value*: T
1
2

BindingsArray

undefined

BindingsArray[LogRecord] = ptr UncheckedArray[ptr ScopeBindingBase[LogRecord]]
1

BindingsFrame

undefined

BindingsFrame[LogRecord] = object
  prev*: ptr BindingsFrame[LogRecord]
  bindings*: BindingsArray[LogRecord]
  bindingsCount*: int
1
2
3
4

Procs



Templates


log_output

Types

FileOutput

undefined

FileOutput = object
  outFile*: File
  outPath: string
  mode: FileMode
1
2
3
4

StdOutOutput

undefined

StdOutOutput = object
1

StdErrOutput

undefined

StdErrOutput = object
1

SysLogOutput

undefined

SysLogOutput = object
  currentRecordLevel: LogLevel
1
2

PassThroughOutput

undefined

PassThroughOutput[FinalOutputs] = object
  finalOutputs: FinalOutputs
1
2

BufferedOutput

undefined

BufferedOutput[FinalOutputs] = object
  finalOutputs: FinalOutputs
  buffer: string
1
2
3

TextLineRecord

undefined

TextLineRecord[Output; timestamps; colors] = object
  output*: Output
  level: LogLevel
1
2
3

TextBlockRecord

undefined

TextBlockRecord[Output; timestamps; colors] = object
  output*: Output
1
2

StreamOutputRef

undefined

StreamOutputRef[Stream; outputId] = object
1

JsonRecord

undefined

JsonRecord[Output; timestamps] = object
  output*: Output
  outStream: OutputStreamVar
  jsonWriter: JsonWriter
1
2
3
4

defaultChroniclesStream

undefined

defaultChroniclesStream {.inject.} = object
1

Procs


open

undefined

proc open(o: ptr FileOutput; path: string; mode = fmAppend): bool {.
    raises: [OSError, IOError], tags: [WriteDirEffect, ReadDirEffect].}
1
2

open

undefined

proc open(o: ptr FileOutput; file: File): bool {.raises: [], tags: [].}
1

initLogRecord

undefined

proc initLogRecord(r: var TextLineRecord; lvl: LogLevel; topics: string; name: string)
1

setProperty

undefined

proc setProperty(r: var TextLineRecord; key: string; val: auto)
1

flushRecord

undefined

proc flushRecord(r: var TextLineRecord)
1

initLogRecord

undefined

proc initLogRecord(r: var TextBlockRecord; level: LogLevel; topics: string; name: string)
1

setProperty

undefined

proc setProperty(r: var TextBlockRecord; key: string; val: auto)
1

flushRecord

undefined

proc flushRecord(r: var TextBlockRecord)
1

initLogRecord

undefined

proc initLogRecord(r: var JsonRecord; level: LogLevel; topics: string; name: string)
1

setProperty

undefined

proc setProperty(r: var JsonRecord; key: string; val: auto)
1

flushRecord

undefined

proc flushRecord(r: var JsonRecord)
1

Templates


activateOutput

undefined

template activateOutput(o: var (StdOutOutput | StdErrOutput); level: LogLevel)
1

activateOutput

undefined

template activateOutput(o: var FileOutput; level: LogLevel)
1

activateOutput

undefined

template activateOutput(o: var StreamOutputRef; level: LogLevel)
1

activateOutput

undefined

template activateOutput(o: var SysLogOutput; level: LogLevel)
1

activateOutput

undefined

template activateOutput(o: var BufferedOutput | PassThroughOutput; level: LogLevel)
1

prepareOutput

undefined

template prepareOutput(r: var auto; level: LogLevel)
1

append

undefined

template append(o: var FileOutput; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var FileOutput)
1

append

undefined

template append(o: var StdOutOutput; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var StdOutOutput)
1

append

undefined

template append(o: var StdErrOutput; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var StdErrOutput)
1

append

undefined

template append(o: var StreamOutputRef; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var StreamOutputRef)
1

append

undefined

template append(o: var SysLogOutput; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var SysLogOutput)
1

append

undefined

template append(o: var BufferedOutput; s: OutStr)
1

flushOutput

undefined

template flushOutput(o: var BufferedOutput)
1

append

undefined

template append(o: var PassThroughOutput; strExpr: OutStr)
1

flushOutput

undefined

template flushOutput(o: var PassThroughOutput)
1

setFirstProperty

undefined

template setFirstProperty(r: var TextLineRecord; key: string; val: auto)
1

setFirstProperty

undefined

template setFirstProperty(r: var TextBlockRecord; key: string; val: auto)
1

setFirstProperty

undefined

template setFirstProperty(r: var JsonRecord; key: string; val: auto)
1

isStreamSymbolIMPL

undefined

template isStreamSymbolIMPL(T: typed): bool
1

isStreamSymbolIMPL

undefined

template isStreamSymbolIMPL(S: type defaultChroniclesStream): bool
1

Record

undefined

template Record(S: type defaultChroniclesStream): typedesc
1

tlsSlot

undefined

template tlsSlot(S: type defaultChroniclesStream): auto
1

outputs

undefined

template outputs(S: type defaultChroniclesStream): auto
1

output

undefined

template output(S: type defaultChroniclesStream): auto
1

activeChroniclesStream

undefined

template activeChroniclesStream(): typedesc
1

options

Types

LogLevel

undefined

LogLevel = enum
  NONE, TRACE, DEBUG, INFO, NOTICE, WARN, ERROR, FATAL
1
2

LogFormat

undefined

LogFormat = enum
  json, textLines, textBlocks
1
2

LogDestinationKind

undefined

LogDestinationKind = enum
  toStdOut, toStdErr, toFile, toSysLog
1
2

LogDestination

undefined

LogDestination = object
  case kind*: LogDestinationKind
  of toFile:
      filename*: string
      truncate*: bool

  else:
      nil
1
2
3
4
5
6
7
8

TimestampsScheme

undefined

TimestampsScheme = enum
  NoTimestamps, UnixTime, RfcTime
1
2

ColorScheme

undefined

ColorScheme = enum
  NoColors, AnsiColors, NativeColors
1
2

SinkSpec

undefined

SinkSpec = object
  format*: LogFormat
  colorScheme*: ColorScheme
  timestamps*: TimestampsScheme
  destinations*: seq[LogDestination]
1
2
3
4
5

StreamSpec

undefined

StreamSpec = object
  name*: string
  sinks*: seq[SinkSpec]
1
2
3

Configuration

undefined

Configuration = object
  streams*: seq[StreamSpec]
1
2

EnabledTopic

undefined

EnabledTopic = object
  name*: string
  logLevel*: LogLevel
1
2
3

Procs


syntaxCheckStreamExpr

undefined

proc syntaxCheckStreamExpr(n: NimNode) {.raises: [], tags: [].}
1

sinkSpecsFromNode

undefined

proc sinkSpecsFromNode(streamNode: NimNode): seq[SinkSpec] {.raises: [Exception],
    tags: [RootEffect].}
1
2

Templates


topicsAsSeq

undefined

template topicsAsSeq(topics: string): untyped
1

scope_helpers

Types

BindingsSet

undefined

BindingsSet = Table[string, NimNode]
1

FinalBindingsSet

undefined

FinalBindingsSet = OrderedTable[string, NimNode]
1

AssignmentsContext

undefined

AssignmentsContext = enum
  acScopeBlock, acLogStatement
1
2

Procs


id

undefined

proc id(key: string; public = false): NimNode {.raises: [], tags: [].}
1

scopeAssignments

undefined

proc scopeAssignments(scopeBody: NimNode): NimNode {.raises: [], tags: [].}
1

scopeRevision

undefined

proc scopeRevision(scopeBody: NimNode): int {.raises: [], tags: [].}
1

lastScopeBody

undefined

proc lastScopeBody(scopes: NimNode): NimNode {.raises: [], tags: [].}
1

handleUserStreamChoice

undefined

proc handleUserStreamChoice(n: NimNode): StreamSpec {.raises: [Exception],
    tags: [RootEffect].}
1
2

skipTypedesc

undefined

proc skipTypedesc(n: NimNode): NimNode {.raises: [], tags: [].}
1

clearEmptyVarargs

undefined

proc clearEmptyVarargs(args: NimNode) {.raises: [], tags: [].}
1

Templates


finalLexicalBindings

undefined

template finalLexicalBindings(scopes: NimNode): NimNode
1