Skip to content

Commit

Permalink
Merge pull request #451 from V4Fire/feat/stderr-details
Browse files Browse the repository at this point in the history
feat(prelude/global): pass error details to the logger
  • Loading branch information
gretzkiy authored Nov 26, 2024
2 parents 84e3818 + 185e544 commit 9be983e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Changelog
_Note: Gaps between patch versions are faulty, broken or test releases._

## v4.0.0-alpha.50 (2024-11-26)

#### :rocket: New Feature

* `stderr` can now accept error details and pass them to the logger `core/prelude/global`

## v4.0.0-alpha.49 (2024-10-31)

#### :bug: Bug Fix
Expand Down
6 changes: 6 additions & 0 deletions src/core/prelude/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Changelog
> - :house: [Internal]
> - :nail_care: [Polish]
## v4.0.0-alpha.50 (2024-11-26)

#### :rocket: New Feature

* `stderr` can now accept error details and pass them to the logger

## v4.0.0-alpha.49 (2024-10-31)

#### :bug: Bug Fix
Expand Down
6 changes: 3 additions & 3 deletions src/core/prelude/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { errorsToIgnore } from 'core/prelude/global/const';
extend(globalThis, 'Any', (obj) => obj);

/** @see stderr */
extend(globalThis, 'stderr', (err) => {
extend(globalThis, 'stderr', (err, ...details: unknown[]) => {
if (err instanceof Object) {
if (errorsToIgnore[err.type] === true) {
log.info('stderr', err);
log.info('stderr', err, ...details);
return;
}

log.error('stderr', err);
log.error('stderr', err, ...details);
}
});
3 changes: 2 additions & 1 deletion ts-definitions/prelude/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ declare function Any(obj: any): any;
/**
* STDERR wrapper
* @param err
* @param details
*/
declare function stderr(err: any): void;
declare function stderr(err: any, ...details: unknown[]): void;

type i18n = (key: string | TemplateStringsArray, params?: I18nParams) => string;

Expand Down

0 comments on commit 9be983e

Please sign in to comment.