mirror of
https://github.com/lasthead0/yandex2mqtt.git
synced 2025-08-08 09:01:00 +03:00
c
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, label, printf} = format;
|
const {combine, timestamp, printf} = format;
|
||||||
/* express and https */
|
/* express and https */
|
||||||
const ejs = require('ejs');
|
const ejs = require('ejs');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
@@ -29,7 +29,7 @@ global.logger = createLogger({
|
|||||||
format: combine(
|
format: combine(
|
||||||
label(),
|
label(),
|
||||||
timestamp(),
|
timestamp(),
|
||||||
printf(({level, message, timestamp, label}) => {
|
printf(({level, message, label, timestamp}) => {
|
||||||
return `${timestamp} [${label}] ${level}: ${message}`;
|
return `${timestamp} [${label}] ${level}: ${message}`;
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
@@ -148,7 +148,7 @@ global.mqttClient = mqtt.connect(`mqtt://${config.mqtt.host}`, {
|
|||||||
}
|
}
|
||||||
}, res => {
|
}, res => {
|
||||||
res.on('data', d => {
|
res.on('data', d => {
|
||||||
global.logger.log('info', 'notification', {message: `${d}`});
|
global.logger.log('info', {message: `${d}`, label: 'notification'});
|
||||||
// process.stdout.write(d);
|
// process.stdout.write(d);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user