Web: Socket.IO: Changed logger settings
This commit is contained in:
parent
f8035967b5
commit
5c97e7ed63
@ -13,21 +13,42 @@ if (!fs.existsSync(dirName)) {
|
||||
fs.mkdirSync(dirName);
|
||||
}
|
||||
|
||||
const fileTransport = new winston.transports.DailyRotateFile({
|
||||
filename: fileName,
|
||||
datePattern: "MM-DD",
|
||||
handleExceptions: true,
|
||||
humanReadableUnhandledException: true,
|
||||
zippedArchive: true,
|
||||
maxSize: "50m",
|
||||
maxFiles: "30d",
|
||||
});
|
||||
var options = {
|
||||
file: {
|
||||
filename: fileName,
|
||||
datePattern: "MM-DD",
|
||||
handleExceptions: true,
|
||||
humanReadableUnhandledException: true,
|
||||
zippedArchive: true,
|
||||
maxSize: "50m",
|
||||
maxFiles: "30d",
|
||||
json: true,
|
||||
},
|
||||
console: {
|
||||
level: "debug",
|
||||
handleExceptions: true,
|
||||
json: false,
|
||||
colorize: true,
|
||||
},
|
||||
};
|
||||
|
||||
const transports = [new winston.transports.Console(), fileTransport];
|
||||
//const fileTransport = new winston.transports.DailyRotateFile(options.file);
|
||||
|
||||
winston.exceptions.handle(fileTransport);
|
||||
const transports = [
|
||||
new winston.transports.Console(options.console),
|
||||
new winston.transports.DailyRotateFile(options.file),
|
||||
];
|
||||
|
||||
//winston.exceptions.handle(fileTransport);
|
||||
|
||||
module.exports = new winston.createLogger({
|
||||
//defaultMeta: { component: "socket.io-server" },
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp({
|
||||
format: "YYYY-MM-DD HH:mm:ss",
|
||||
}),
|
||||
winston.format.json()
|
||||
),
|
||||
transports: transports,
|
||||
exitOnError: false,
|
||||
});
|
||||
|
@ -89,6 +89,6 @@ const filesHub = require("./app/hubs/files.js")(io);
|
||||
|
||||
app.use("/controller", require("./app/controllers")(filesHub));
|
||||
|
||||
httpServer.listen(port, () => console.log(`Server started on port: ${port}`));
|
||||
httpServer.listen(port, () => winston.info(`Server started on port: ${port}`));
|
||||
|
||||
module.exports = io;
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 9fea7818de9abb29295c51b39a54c566bead9895
|
||||
Subproject commit 2bb4d878b42e8c648dd44fed7d445163772551fa
|
Loading…
Reference in New Issue
Block a user