Loxer - v3.0.0
    Preparing search index...

    Interface TraceOptions<Args, Result>

    Options shared by the @trace() method decorator and the trace() function marker in each of its forms.

    A marker that names its target — trace(target | [targets], options) — infers Args and Result from it, from the union of every listed target when it marks a list. @trace() and the trace(options) marker inside a function have no signature in hand, so supply them explicitly when formatter callbacks need precise types. parent.functionName names the class a traced method belongs to — a decorated method, or a method, getter, setter, or field a marker reaches inside a class body — and otherwise the file a marked function is written in. A class name ending in Class reports without that suffix. The decorator reads its class from the running instance, and the file name comes from the build, so a decorated method that a call reaches detached from its class reports its own name alone.

    interface TraceOptions<
        Args extends readonly unknown[] = readonly unknown[],
        Result = unknown,
    > {
        openMessage?: FunctionOpenMessage<Args>;
        closeMessage?: FunctionCloseMessage<Result>;
        moduleId?: string;
        level?: BoxLevel;
        name?: string;
        highlight?: TraceHighlight;
        argsAsProps?: boolean;
        resultAsProps?: boolean;
        printArgs?: boolean | PropsPrinterOptions;
        printResult?: boolean | PropsPrinterOptions;
    }

    Type Parameters

    • Args extends readonly unknown[] = readonly unknown[]
    • Result = unknown
    Index
    openMessage?: FunctionOpenMessage<Args>

    controls the opening trace message

    closeMessage?: FunctionCloseMessage<Result>

    controls the successful closing trace message

    moduleId?: string

    the corresponding key of a LoxerModule provided during Loxer.init()

    Is a string by default. Augment the LoxerModuleRegistry (exported from loxer) to have the accepted ids autocompleted and typo-checked against the modules of your project.

    level?: BoxLevel

    the BoxLevel of the trace box. defaults to 'info'

    'error' is not accepted, because a trace opens and closes a box while an error is a single event.

    name?: string

    the name a marked function reports in its box messages

    A function reached by a marker rather than by name — a literal passed to trace(), or the function a trace(options) statement sits in — is named after itself, or after the binding, assignment target, or property it belongs to: const load = useCallback(trace(...), []) reports load. Supply name where nothing names it, such as useEffect(trace(() => { ... }, { name: 'syncOrders' }), []).

    Has to be a string literal, because the transform reads it while it builds. @trace() and trace(namedFunction, options) know their target's name and ignore it.

    highlight?: TraceHighlight

    which lifecycle messages should be highlighted

    argsAsProps?: boolean

    attaches the call's arguments to the opening log, one prop per argument

    resultAsProps?: boolean

    attaches a defined resolved result to the closing log, as a single prop; a void result attaches none

    printArgs?: boolean | PropsPrinterOptions

    asks the built-in output to render the opening log's props, and configures that rendering

    Like TraceOptions.argsAsProps, this only concerns the arguments. Set it to true for the default configuration, or to a PropsPrinterOptions object to bound the rendering - { depth: 1 } keeps a wide argument list readable.

    printResult?: boolean | PropsPrinterOptions

    asks the built-in output to render the closing log's props, and configures that rendering

    The counterpart of TraceOptions.printArgs for the result.