Skip to content

Commit

Permalink
fix: listenUnhandledErrors default logger name
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Feb 6, 2021
1 parent 98f10cd commit 05c389a
Show file tree
Hide file tree
Showing 22 changed files with 28 additions and 23 deletions.
7 changes: 6 additions & 1 deletion packages/nightingale-console-example/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Logger, { configure, Level } from 'nightingale';
import Logger, { configure, Level, listenUnhandledErrors } from 'nightingale';
import ConsoleHandler from 'nightingale-console';

configure([{ handlers: [new ConsoleHandler(Level.INFO)] }]);
listenUnhandledErrors();

const logger = new Logger('nightingale:console');

logger.debug('test');
logger.info('test');
logger.warn('test');

new Promise((resolve, reject) => {
reject(new Error('Testing uncaught error'));
});
2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser-dev.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser-dev.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser-dev.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser-dev.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browser.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browsermodern-dev.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browsermodern.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-browsermodern.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12-dev.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12-dev.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12-dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if (global.__NIGHTINGALE_GET_CONFIG_FOR_LOGGER_RECORD) {
* @param {Logger} [logger]
*/

function listenUnhandledErrors(logger = new Logger('nightingale.listenUnhandledErrors', 'listenUnhandledErrors')) {
function listenUnhandledErrors(logger = new Logger('nightingale:listenUnhandledErrors', 'UnhandledErrors')) {
process.on('uncaughtException', error => logger.error('uncaughtException', {
error,
unhandled: true
Expand Down
2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12-dev.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ if (global.__NIGHTINGALE_GET_CONFIG_FOR_LOGGER_RECORD) {
* @param {Logger} [logger]
*/

function listenUnhandledErrors(logger = new Logger('nightingale.listenUnhandledErrors', 'listenUnhandledErrors')) {
function listenUnhandledErrors(logger = new Logger('nightingale:listenUnhandledErrors', 'UnhandledErrors')) {
process.on('uncaughtException', error => logger.error('uncaughtException', {
error,
unhandled: true
Expand Down
2 changes: 1 addition & 1 deletion packages/nightingale/dist/index-node12.mjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/nightingale/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export { Logger, Level, Level as levels };
*/
export function listenUnhandledErrors(
logger: Logger = new Logger(
'nightingale.listenUnhandledErrors',
'listenUnhandledErrors',
'nightingale:listenUnhandledErrors',
'UnhandledErrors',
),
): void {
process.on('uncaughtException', (error) =>
Expand Down

0 comments on commit 05c389a

Please sign in to comment.