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