import React, { createContext, useContext } from 'react';
import { AppConsoleLogger, LogLevel } from '../services/logger';
export const AppCommons = /*#__PURE__*/createContext(null);
export const CommonUtilProvider = _ref => {
  let {
    children
  } = _ref;
  const logger = new AppConsoleLogger(LogLevel.test);
  const log = async (messaage, logLevel) => {
    logger.log(logLevel, messaage);
    //TODO: do some more logic like collecting errors for later logging and investigation
  };

  return /*#__PURE__*/React.createElement(AppCommons.Provider, {
    value: {
      log: log
    }
  }, children);
};
export const useCommons = () => {
  const commonsContext = useContext(AppCommons);
  if (!commonsContext) {
    throw new Error('commonsContext must be used within a CommonUtilProvider');
  }
  return commonsContext;
};
//# sourceMappingURL=commons.js.map