Skip to content
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

[Bug]: Winston does not print log error when throw or process.exit() afterwards #2520

Open
abgonzalez93 opened this issue Oct 17, 2024 · 0 comments

Comments

@abgonzalez93
Copy link

abgonzalez93 commented Oct 17, 2024

🔎 Search Terms

winston not printing trace, winston not creating any outpout

The problem

Winston does not print log error when throw or process.exit() afterwards

What version of Winston presents the issue?

3.15.0

What version of Node are you using?

20.18.0

If this worked in a previous version of Winston, which was it?

No response

Minimum Working Example

`
import logger from '@logging/logger'
import Config from '@config/Config'

const required = ['DB_URI', 'JWT_SECRET_ACCESS', 'JWT_SECRET_REFRESH']

const requiredConfig = (config: Config): void => {
const missingKeys = required.filter((key) => !config[key as keyof Config])

if (missingKeys.length > 0) {
const errorMessage = Missing required config values in .env file: ${missingKeys.join(', ')}
logger.error(errorMessage)
throw new Error(errorMessage)
}
}

export default requiredConfig
`

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant