UNPKG

@inward/extension-logging

Version:

LoopBack Logging for Winston and Fluentd

29 lines (26 loc) 781 B
// Copyright IBM Corp. 2019,2020. All Rights Reserved. // Node module: @inward/extension-logging // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT import {intercept} from '@inward/context'; import {LoggingBindings} from '../keys'; /** * `@logInvocation` decorator for method invocations. * * @example * ```ts * import {logInvocation} from '@inward/extension-logging'; * * export class HelloController { * @logInvocation() * hello(name: string) { * return `Hello, ${name}`; * } * } * ``` */ export function logInvocation() { // A shortcut to `@intercept` that invokes the winston interceptor that logs // method invocations return intercept(LoggingBindings.WINSTON_INVOCATION_LOGGER); }