@eroc/core
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -1,2 +0,2 @@ | ||
/* @eroc/core v2.1.0 2020-01-23T22:07:50.616Z licensed MIT */ | ||
/* @eroc/core v2.2.0 2020-02-03T16:50:19.756Z licensed MIT */ | ||
const startEventRecorder = (core) => { | ||
@@ -66,2 +66,16 @@ const events = []; | ||
const useDefaultLogging = (core, { logger = console } = {}) => { | ||
// listen for all events | ||
core.on(ALL, ({ name, data, time }) => { | ||
const timeString = new Date(time).toISOString(); | ||
logger.debug(`${timeString} event ${String(name)} with data`, data); | ||
}); | ||
core.on(ERROR, ({ time, phase, error }) => { | ||
const timeString = new Date(time).toISOString(); | ||
console.error(`Error during phase ${phase} at ${timeString}`, error); | ||
}); | ||
}; | ||
/** | ||
@@ -312,2 +326,2 @@ * Use it as a constructor | ||
export { ALL, Core, ERROR, replayEvents, startEventRecorder, stopEventRecorder }; | ||
export { ALL, Core, ERROR, replayEvents, startEventRecorder, stopEventRecorder, useDefaultLogging }; |
@@ -1,2 +0,2 @@ | ||
/* @eroc/core v2.1.0 2020-01-23T22:07:50.616Z licensed MIT */ | ||
/* @eroc/core v2.2.0 2020-02-03T16:50:19.756Z licensed MIT */ | ||
var Core = (function (exports) { | ||
@@ -69,2 +69,16 @@ 'use strict'; | ||
const useDefaultLogging = (core, { logger = console } = {}) => { | ||
// listen for all events | ||
core.on(ALL, ({ name, data, time }) => { | ||
const timeString = new Date(time).toISOString(); | ||
logger.debug(`${timeString} event ${String(name)} with data`, data); | ||
}); | ||
core.on(ERROR, ({ time, phase, error }) => { | ||
const timeString = new Date(time).toISOString(); | ||
console.error(`Error during phase ${phase} at ${timeString}`, error); | ||
}); | ||
}; | ||
/** | ||
@@ -321,2 +335,3 @@ * Use it as a constructor | ||
exports.stopEventRecorder = stopEventRecorder; | ||
exports.useDefaultLogging = useDefaultLogging; | ||
@@ -323,0 +338,0 @@ return exports; |
@@ -1,2 +0,2 @@ | ||
/* @eroc/core v2.1.0 2020-01-23T22:07:50.616Z licensed MIT */ | ||
/* @eroc/core v2.2.0 2020-02-03T16:50:19.756Z licensed MIT */ | ||
(function (global, factory) { | ||
@@ -72,2 +72,16 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
const useDefaultLogging = (core, { logger = console } = {}) => { | ||
// listen for all events | ||
core.on(ALL, ({ name, data, time }) => { | ||
const timeString = new Date(time).toISOString(); | ||
logger.debug(`${timeString} event ${String(name)} with data`, data); | ||
}); | ||
core.on(ERROR, ({ time, phase, error }) => { | ||
const timeString = new Date(time).toISOString(); | ||
console.error(`Error during phase ${phase} at ${timeString}`, error); | ||
}); | ||
}; | ||
/** | ||
@@ -324,2 +338,3 @@ * Use it as a constructor | ||
exports.stopEventRecorder = stopEventRecorder; | ||
exports.useDefaultLogging = useDefaultLogging; | ||
@@ -326,0 +341,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@eroc/core", | ||
"version": "2.1.0", | ||
"main": "dist/core.umd.js", | ||
"module": "dist/core.es.js", | ||
"version": "2.2.0", | ||
"description": "Lightweight framework for scalable applications", | ||
"license": "MIT", | ||
"author": "Mauricio Soares", | ||
"homepage": "https://github.com/msodeveloper/core.js", | ||
"license": "MIT", | ||
"main": "dist/core.umd.js", | ||
"module": "dist/core.es.js", | ||
"scripts": { | ||
@@ -19,28 +19,8 @@ "serve": "serve . -p 8080", | ||
}, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/msodeveloper/core.js.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/msodeveloper/core.js/issues" | ||
}, | ||
"keywords": [ | ||
"core.js", | ||
"core", | ||
"framework", | ||
"lightweight", | ||
"scalable" | ||
], | ||
"devDependencies": { | ||
"eslint": "^6.2.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-red": "^1.1.0", | ||
"jasmine": "^3.4.0", | ||
"jasmine": "^3.5.0", | ||
"rollup": "^1.19.4", | ||
"serve": "^11.1.0" | ||
"serve": "^11.3.0" | ||
}, | ||
@@ -66,3 +46,23 @@ "dependencies": { | ||
"rules": {} | ||
} | ||
}, | ||
"files": [ | ||
"src", | ||
"dist", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/msodeveloper/core.js.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/msodeveloper/core.js/issues" | ||
}, | ||
"keywords": [ | ||
"core.js", | ||
"core", | ||
"framework", | ||
"lightweight", | ||
"scalable" | ||
] | ||
} |
@@ -180,4 +180,3 @@ # core [![Build Status](https://travis-ci.org/mauriciosoares/core.js.svg?branch=master)](https://travis-ci.org/mauriciosoares/core.js) [![Coverage Status](https://img.shields.io/coveralls/mauriciosoares/core.js.svg)](https://coveralls.io/r/mauriciosoares/core.js) [![Code Climate](https://codeclimate.com/github/mauriciosoares/core.js/badges/gpa.svg)](https://codeclimate.com/github/mauriciosoares/core.js) | ||
const timeString = new Date(time).toISOString(); | ||
console.error(`Error during phase ${phase} at ${timeString}`); | ||
console.error(error); | ||
console.error(`Error during phase ${phase} at ${timeString}`, error); | ||
}); | ||
@@ -184,0 +183,0 @@ ``` |
export { Core, ALL, ERROR }; | ||
export { startEventRecorder, stopEventRecorder } from "./eventRecorder.js"; | ||
export { replayEvents } from "./eventPlayer.js"; | ||
export { useDefaultLogging } from "./logging.js"; | ||
import EventEmitter from "../node_modules/event-e3/event-e3.js"; | ||
@@ -5,0 +6,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48770
11
1217
261