mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
fix: Use custom logger only for production
This commit is contained in:
parent
33d36d80eb
commit
c40709a509
5 changed files with 26 additions and 27 deletions
|
@ -1,9 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# db
|
|
||||||
node db/init.js
|
node db/init.js
|
||||||
|
exec node app.js --prod $@
|
||||||
# app
|
|
||||||
export NODE_ENV=production
|
|
||||||
exec node app.js
|
|
||||||
|
|
21
server/config/env/production.js
vendored
21
server/config/env/production.js
vendored
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
|
|
||||||
|
const { customLogger } = require('../../utils/logger');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -243,7 +245,24 @@ module.exports = {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
log: {},
|
log: {
|
||||||
|
/**
|
||||||
|
* Passthrough plain log message(s) to
|
||||||
|
* custom Winston console and file logger.
|
||||||
|
*
|
||||||
|
* Note that Winston's log levels override Sails' log levels.
|
||||||
|
* Refer: https://github.com/winstonjs/winston#logging
|
||||||
|
*/
|
||||||
|
|
||||||
|
inspect: false,
|
||||||
|
custom: customLogger,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the Sail.js init success logs (ASCII ship art).
|
||||||
|
*/
|
||||||
|
|
||||||
|
noShip: true,
|
||||||
|
},
|
||||||
|
|
||||||
http: {
|
http: {
|
||||||
/**
|
/**
|
||||||
|
|
4
server/config/env/test.js
vendored
4
server/config/env/test.js
vendored
|
@ -64,5 +64,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
log: {},
|
log: {
|
||||||
|
level: 'warn',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
* https://sailsjs.com/docs/concepts/logging
|
* https://sailsjs.com/docs/concepts/logging
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { customLogger } = require('../utils/logger');
|
|
||||||
|
|
||||||
module.exports.log = {
|
module.exports.log = {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -24,20 +22,5 @@ module.exports.log = {
|
||||||
* You may also set the level to "silent" to suppress all logs.
|
* You may also set the level to "silent" to suppress all logs.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
// level: 'info',
|
||||||
/**
|
|
||||||
* Passthrough plain log message(s) to
|
|
||||||
* custom Winston console and file logger.
|
|
||||||
*
|
|
||||||
* Note that Winston's log levels override Sails' log levels.
|
|
||||||
* Refer: https://github.com/winstonjs/winston#logging
|
|
||||||
*/
|
|
||||||
custom: customLogger,
|
|
||||||
inspect: false,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the Sail.js init success logs
|
|
||||||
* (ASCII ship art) for production instances.
|
|
||||||
*/
|
|
||||||
noShip: process.env.NODE_ENV === 'production',
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ const logfile = `${process.cwd()}/logs/planka.log`;
|
||||||
* Refer {@link https://github.com/winstonjs/winston#logging here}
|
* Refer {@link https://github.com/winstonjs/winston#logging here}
|
||||||
* for more information on Winston log levels.
|
* for more information on Winston log levels.
|
||||||
*/
|
*/
|
||||||
const logLevel = process.env.NODE_ENV === 'production' ? 'info' : 'debug';
|
const logLevel = 'warn'; // process.env.NODE_ENV === 'production' ? 'info' : 'debug';
|
||||||
|
|
||||||
const logFormat = winston.format.combine(
|
const logFormat = winston.format.combine(
|
||||||
winston.format.uncolorize(),
|
winston.format.uncolorize(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue