Page Contents

Home > @loopback/extension-logging > logInvocation

logInvocation() function

decorator for method invocations.

Signature:

export declare function logInvocation(): (target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor<any> | undefined) => any;

Returns:

(target: any, method?: string | undefined, methodDescriptor?: TypedPropertyDescriptor<any> | undefined) => any

Example

import {logInvocation} from '@loopback/extension-logging';

export class HelloController {
  @logInvocation()
  hello(name: string) {
    return `Hello, ${name}`;
  }
}