Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanvelasco/winston-mqtt
MQTT transport for Winston
https://github.com/seanvelasco/winston-mqtt
logger logging mqtt winston winston-transport
Last synced: 2 months ago
JSON representation
MQTT transport for Winston
- Host: GitHub
- URL: https://github.com/seanvelasco/winston-mqtt
- Owner: seanvelasco
- Created: 2022-08-08T17:07:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-21T01:56:43.000Z (7 months ago)
- Last Synced: 2024-11-13T06:16:14.455Z (3 months ago)
- Topics: logger, logging, mqtt, winston, winston-transport
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@seanvelasco/winston-mqtt
- Size: 94.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
```
npm install @seanvelasco/winston-mqtt
```## Usage
```typescript
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