Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 520 Bytes

TimerService.md

File metadata and controls

21 lines (15 loc) · 520 Bytes

TimerService

Timer helper that can be used to measure how long operations take.

Usage

Start and stop the timer using the start and stop methods.

import lambdaWrapper, { TimerService } from '@comicrelief/lambda-wrapper';

export default lambdaWrapper.wrap(async (di) => {
  const timer = di.get(TimerService);

  const timerId = 'someLongSlowOperation';
  timer.start(timerId);
  await someLongSlowOperation();
  timer.stop(timerId);
  // logs 'someLongSlowOperation took 12345 ms to complete'
});