Console.log should be removed for production builds #8

Open
opened 2022-03-30 08:36:48 +00:00 by Ghost · 0 comments

When running in prodcution, I would like othave a way to disable to console.log messages.

We are using a docker run script, and it is messing up the output for no reason.

File: latests.js

Output cod:
console.log('Needs latest SSL Root Certificate Authority data', latestFile);
module.exports = require('./ssl-root-cas');
generate(latestFile).then(function () {
console.info('\n');
console.info('##########################################################################################');
console.info('# #');
console.info('# Downloaded the latest Root Certificate Authorities. Restart your server to use them. #');
console.info('# #');
console.info('##########################################################################################');
console.info('\n');
}, function (e) {
console.warn('\n\n');
console.warn("Couldn't download the latest Root CAs, but it's not a big deal.");
console.warn('');
console.warn('Use "require('ssl-root-cas')" instead of "require('ssl-root-cas/latest')"');
console.warn('');
});

Potential djustment:

if (process.env.NODE_ENV !== "production") {
console.log("log here")
}

Or provide a small script to load the files before starting the application?

When running in prodcution, I would like othave a way to disable to console.log messages. We are using a docker run script, and it is messing up the output for no reason. File: latests.js Output cod: console.log('Needs latest SSL Root Certificate Authority data', latestFile); module.exports = require('./ssl-root-cas'); generate(latestFile).then(function () { console.info('\n'); console.info('##########################################################################################'); console.info('# #'); console.info('# Downloaded the latest Root Certificate Authorities. Restart your server to use them. #'); console.info('# #'); console.info('##########################################################################################'); console.info('\n'); }, function (e) { console.warn('\n\n'); console.warn("Couldn't download the latest Root CAs, but it's not a big deal."); console.warn(''); console.warn('Use "require(\'ssl-root-cas\')" instead of "require(\'ssl-root-cas/latest\')"'); console.warn(''); }); Potential djustment: if (process.env.NODE_ENV !== "production") { console.log("log here") } Or provide a small script to load the files before starting the application?
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coolaj86/ssl-root-cas.js#8
No description provided.