UNPKG

@playkit-js/playkit-js-ui

Version:

[![Build Status](https://github.com/kaltura/playkit-js-ui/actions/workflows/run_canary_full_flow.yaml/badge.svg)](https://github.com/kaltura/playkit-js-ui/actions/workflows/run_canary_full_flow.yaml) [![code style: prettier](https://img.shields.io/badge/c

29 lines (26 loc) 724 B
// @flow /* eslint-disable no-unused-vars */ import getLogger from '../utils/logger'; import {UIOptionsObject} from '../types'; let logger; /** * The logger middleware. * Prints action logs in case of received debug=true from the UI config. * @param {UIOptionsObject} config - The UI config. * @returns {void} */ const loggerMiddleware = (config: UIOptionsObject) => // eslint-disable-next-line @typescript-eslint/no-unused-vars (store: any) => (next: (...args: any) => any) => (action: any): void => { if (!logger) { logger = getLogger('UILoggerMiddleware'); } if (config.debugActions) { logger.debug('Action fired', action); } next(action); }; export {loggerMiddleware};