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:
6
app.js
6
app.js
@@ -4,7 +4,7 @@ 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, prettyPrint} = format;
|
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');
|
||||||
@@ -33,10 +33,8 @@ global.logger = createLogger({
|
|||||||
errors({stack: true}),
|
errors({stack: true}),
|
||||||
timestamp(),
|
timestamp(),
|
||||||
printf(({level, message, timestamp, stack}) => {
|
printf(({level, message, timestamp, stack}) => {
|
||||||
//console.dir(a, {depth: 9});
|
|
||||||
return `${timestamp} ${level}: ${stack != undefined ? stack : message}`;
|
return `${timestamp} ${level}: ${stack != undefined ? stack : message}`;
|
||||||
})
|
}),
|
||||||
// prettyPrint()
|
|
||||||
),
|
),
|
||||||
transports: [
|
transports: [
|
||||||
new transports.Console({
|
new transports.Console({
|
||||||
|
Reference in New Issue
Block a user