mirror of
https://github.com/lasthead0/yandex2mqtt.git
synced 2025-08-08 09:01:00 +03:00
Add logging and some code improvement
This commit is contained in:
9
app.js
9
app.js
@@ -4,7 +4,6 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
/* */
|
/* */
|
||||||
const {createLogger, format, transports} = require('winston');
|
const {createLogger, format, transports} = require('winston');
|
||||||
const {combine, timestamp, printf, errors} = format;
|
|
||||||
/* express and https */
|
/* express and https */
|
||||||
const ejs = require('ejs');
|
const ejs = require('ejs');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
@@ -29,10 +28,10 @@ const clArgv = process.argv.slice(2);
|
|||||||
/* Logging */
|
/* Logging */
|
||||||
global.logger = createLogger({
|
global.logger = createLogger({
|
||||||
level: 'info',
|
level: 'info',
|
||||||
format: combine(
|
format: format.combine(
|
||||||
errors({stack: true}),
|
format.errors({stack: true}),
|
||||||
timestamp(),
|
format.timestamp(),
|
||||||
printf(({level, message, timestamp, stack}) => {
|
format.printf(({level, message, timestamp, stack}) => {
|
||||||
return `${timestamp} ${level}: ${stack != undefined ? stack : message}`;
|
return `${timestamp} ${level}: ${stack != undefined ? stack : message}`;
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user