warn.js 892 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Global } from './config';
  2. const isLog = function (type, errText, enforce) {
  3. if (!enforce) {
  4. const dev = Global.Router.CONFIG.debugger;
  5. const isObject = dev.toString() === '[object Object]';
  6. if (dev === false) {
  7. return false;
  8. } if (dev === false) {
  9. return false;
  10. } if (isObject) {
  11. if (dev[type] === false) {
  12. return false;
  13. }
  14. }
  15. }
  16. /* eslint no-console:"off" */
  17. console[type](errText);
  18. };
  19. export const err = function (errInfo, enforce = false) {
  20. isLog('error', errInfo, enforce);
  21. };
  22. export const warn = function (errInfo, enforce = false) {
  23. isLog('warn', errInfo, enforce);
  24. };
  25. export const log = function (errInfo, enforce = false) {
  26. isLog('log', errInfo, enforce);
  27. };
  28. export const warnLock = function (errInfo) {
  29. console.warn(errInfo);
  30. };