feat: disable console log for pkg
This commit is contained in:
parent
4445443946
commit
4ae28e48b5
|
|
@ -27,6 +27,7 @@ module.exports = {
|
|||
},
|
||||
get value() {
|
||||
return {
|
||||
isPackage: envs.isPackage,
|
||||
connect: {
|
||||
port: envs.PORT || 1200, // 监听端口
|
||||
socket: envs.SOCKET || null, // 监听 Unix Socket, null 为禁用
|
||||
|
|
|
|||
|
|
@ -3,7 +3,14 @@ const config = require('./config');
|
|||
|
||||
module.exports = {
|
||||
init: (conf) => {
|
||||
config.set(conf);
|
||||
config.set(
|
||||
Object.assign(
|
||||
{
|
||||
isPackage: true,
|
||||
},
|
||||
conf
|
||||
)
|
||||
);
|
||||
app = require('./app');
|
||||
},
|
||||
request: (path) =>
|
||||
|
|
|
|||
|
|
@ -21,11 +21,13 @@ const logger = winston.createLogger({
|
|||
// If we're not in production then log to the `console` with the format:
|
||||
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
||||
//
|
||||
logger.add(
|
||||
new winston.transports.Console({
|
||||
format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
|
||||
silent: process.env.NODE_ENV === 'test',
|
||||
})
|
||||
);
|
||||
if (!config.isPackage) {
|
||||
logger.add(
|
||||
new winston.transports.Console({
|
||||
format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
|
||||
silent: process.env.NODE_ENV === 'test',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = logger;
|
||||
|
|
|
|||
Loading…
Reference in New Issue