-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web: Socket.IO: added winston logger, remover unused code, updated pa…
…ckages
- Loading branch information
1 parent
99e37d9
commit 62ffa58
Showing
21 changed files
with
1,728 additions
and
6,401 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
const winston = require('winston'); | ||
require('winston-daily-rotate-file') | ||
const winston = require("winston"); | ||
require("winston-daily-rotate-file"); | ||
|
||
const path = require('path'); | ||
const config = require('../config'); | ||
const fs = require('fs'); | ||
const fileName = config.get("logPath") || path.join(__dirname, "..", "..", "Logs", "web.socketio.%DATE%.log"); | ||
const path = require("path"); | ||
const config = require("../config"); | ||
const fs = require("fs"); | ||
const fileName = | ||
config.get("logPath") || | ||
path.join(__dirname, "..", "..", "Logs", "web.socketio.%DATE%.log"); | ||
const dirName = path.dirname(fileName); | ||
|
||
if (!fs.existsSync(dirName)) { | ||
fs.mkdirSync(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' | ||
const fileTransport = new winston.transports.DailyRotateFile({ | ||
filename: fileName, | ||
datePattern: "MM-DD", | ||
handleExceptions: true, | ||
humanReadableUnhandledException: true, | ||
zippedArchive: true, | ||
maxSize: "50m", | ||
maxFiles: "30d", | ||
}); | ||
|
||
const transports = [ | ||
new (winston.transports.Console)(), | ||
fileTransport | ||
]; | ||
const transports = [new winston.transports.Console(), fileTransport]; | ||
|
||
winston.handleExceptions(fileTransport); | ||
winston.exceptions.handle(fileTransport); | ||
|
||
module.exports = new winston.Logger({ transports: transports, exitOnError: false}); | ||
module.exports = new winston.createLogger({ | ||
transports: transports, | ||
exitOnError: false, | ||
}); |
Oops, something went wrong.