-
Notifications
You must be signed in to change notification settings - Fork 1
Nest logger doesn’t log unhandled errors properly #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e6afaa
fix(nest-logger): remove faulty array wrapping for logging
dario-fazio db0521b
build(release): next version [skip_build]
actions-user bf0b406
fix(nest-logger): spread optional parameters in logging methods
dario-fazio 6cab143
build(release): next version [skip_build]
actions-user 12be563
fix(nest-logger): add unit tests for NestLogger methods to verify arg…
dario-fazio 6655a3a
build(release): next version [skip_build]
actions-user File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { Logger, LogLevel } from '@shiftcode/logger' | ||
| import { beforeEach, describe, expect, test } from 'vitest' | ||
|
|
||
| import { MockLogTransport } from '../../test/mock-log.transport.js' | ||
| import { NestLogger } from './nest-logger.js' | ||
|
|
||
| describe('NestLogger', () => { | ||
| let transport: MockLogTransport | ||
| let logger: Logger | ||
| let nestLogger: NestLogger | ||
|
|
||
| beforeEach(() => { | ||
| transport = new MockLogTransport({ logLevel: LogLevel.DEBUG, mockAttribute: 'test' }) | ||
| logger = new Logger('TestLogger', '#ffffff', [transport]) | ||
| nestLogger = new NestLogger(logger) | ||
| }) | ||
|
|
||
| test('error(message, trace, context) forwards args as flat array, not nested', () => { | ||
| nestLogger.error('msg', 'trace', 'ctx') | ||
| expect(transport.logArgs?.args).toEqual(['msg', 'trace', 'ctx']) | ||
| }) | ||
|
|
||
| test('warn(message, context) forwards args as flat array', () => { | ||
| nestLogger.warn('msg', 'ctx') | ||
| expect(transport.logArgs?.args).toEqual(['msg', 'ctx']) | ||
| }) | ||
|
|
||
| test('log(message, context) forwards args as flat array', () => { | ||
| nestLogger.log('msg', 'ctx') | ||
| expect(transport.logArgs?.args).toEqual(['msg', 'ctx']) | ||
| }) | ||
|
|
||
| test('debug(message, context) forwards args as flat array', () => { | ||
| nestLogger.debug('msg', 'ctx') | ||
| expect(transport.logArgs?.args).toEqual(['msg', 'ctx']) | ||
| }) | ||
|
|
||
| test('verbose(message, context) forwards args as flat array', () => { | ||
| nestLogger.verbose('msg', 'ctx') | ||
| expect(transport.logArgs?.args).toEqual(['msg', 'ctx']) | ||
| }) | ||
|
|
||
| test('error with only a message forwards a single-element args array', () => { | ||
| nestLogger.error('only message') | ||
| expect(transport.logArgs?.args).toEqual(['only message']) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.