🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@seanvelasco/winston-mqtt

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seanvelasco/winston-mqtt

MQTT Transport for Winston

latest
Source
npmnpm
Version
1.1.5
Version published
Maintainers
1
Created
Source

Installation

npm install @seanvelasco/winston-mqtt

Usage

import winston from 'winston'
import MQTT from '@seanvelasco/winston-mqtt'

const mqttOptions = {
    host: '127.0.0.1',
    port: 1883,
    clientId: '',
    username: '',
    password: '',
}

const logger = winston.createLogger({
    level: 'info',
    transports: [
        new winston.transports.File({ filename: 'info.log', level: 'info' }),
        new MQTT({ ...mqttOptions, topic: 'diagnostics/info', level: 'info' }),
    ]
})

Features

Include level, log message, and meta properties in the message as JSON payload

Pass includeMeta: true when instantiating the MQTT transport to include the level, message, and meta properties in the message as JSON payload.

Limitations

  • Creates new MQTT client for each transport
  • Unable to reuse the same MQTT client for multiple transports
  • Does not support multiple topics for the same transport
  • No TLS support

In the future

  • TLS support
  • Reuse MQTT client for multiple transports
  • Add option for delayed publishing

Keywords

winston

FAQs

Package last updated on 14 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts