Skip to content

Commit

Permalink
change: remove handler for event unhandleRejection on node
Browse files Browse the repository at this point in the history
  • Loading branch information
butthx committed Dec 23, 2023
1 parent bebab96 commit df7d906
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ log.log('Hello World'); // (name) info - Hello World DD/MM/YY hh:mm:ss.ms

**The log capture feature is only available on node js and deno platforms, not available for browsers!**

To capture logs we use env as the trigger. When in the env have `CAPTURELOG` The capture function will automatically work and stop when the program is finished (`beforeExit`, `exit` event on node and `beforeunload`,`unload` event on deno) or when it is forced to stop due to an error (`unhandledRejection` event on node and `unhandledrejection` on deno).
To capture logs we use env as the trigger. When in the env have `CAPTURELOG` The capture function will automatically work and stop when the program is finished (`beforeExit`, `exit` event on node and `beforeunload`,`unload`, `unhadlerejection` event on deno) or when it is forced to stop due to an error.
The log will be captured in the form of a log file with filename format: `{name}-{Date.now()}.log` and will be saved in the current work dir (cwd).
Value of env `CAPTURELOG` is name of logger or can be `'all'` for each instance the logger runs the capture function.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tgsnake/log",
"version": "1.6.1",
"version": "1.6.2",
"description": "logging framework for tgsnake",
"main": "./lib/index.js",
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion src/platform.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export { type Chalk, Instance as ChalkInstance, path, fs };
export function onEndProcess(cb: { (e?: any): any }) {
process.on('beforeExit', cb);
process.on('exit', cb);
process.on('unhandledRejection', cb);
}
export const { cwd } = process;
export const isBrowser = typeof window !== 'undefined';

0 comments on commit df7d906

Please sign in to comment.