Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface TraceOptions

The Options for the @trace(options: TracerOptions | string) decorator

Hierarchy

  • TraceOptions

Properties

Optional moduleId

moduleId: string

the corresponding key of a LoxerModule provided in the LoxerOptions.modules for the Loxer.init(options: LoxerOptions) initialization

Optional level

the level of the log. defaults to 1

Optional highlight

highlight: "open" | "close" | "all"

which messages should be highlighted

Optional openMessage

openMessage: function | "functionName" | "className.functionName" | "types" | "args"

how should the opening message be styled. for example if MyServiceClass.myFunction(a: number, b: string) is called with myFunction(3, "test"):

  • 'functionName': prints "myFunction()"
  • 'className.functionName': prints "MyService.myFunction()" (the postfix Class will be erased though it is clear that it's a class, when a method is decorated)
  • 'types': prints "myFunction(number, string)" (with the types of the actual arguments)
  • 'args': prints "myFunction(3, "test")" (with the actual arguments)
  • (args: any[]) => string) is a callback which provides the actual arguments.
  • defaults to 'functionName'

Optional closeMessage

closeMessage: "functionName" | "className.functionName" | function | "result" | "prettyResult"

how should the opening message be styled. for example if MyServiceClass.myFunction(a: number, b: string) returns {val: "test", count: 5}:

  • 'functionName': prints "myFunction done"
  • 'className.functionName': prints "MyService.myFunction done" (the postfix Class will be erased though it is clear that it's a class, when a method is decorated)
  • 'result': prints "myFunction done. returns: {val: "test", count: 5}"
  • 'prettyResult': prints:
    myFunction done. returns:
    {
        val: "test",
        count: 5
    }
    
  • (result?: any) => string) is a callback which provides the actual result.
  • defaults to 'functionName'

Optional argsAsItem

argsAsItem: boolean

appends the arguments as item: any to the open log.

  • defaults to false

Optional resultAsItem

resultAsItem: boolean

appends the result as item: any to the close log.

  • defaults to false

Generated using TypeDoc