udp-transport-winston
v2.0.14
Published
A winston transport for UDP in typescript
Downloads
4,504
Maintainers
Readme
UDP-transport-winston
A simple winston transport for UDP in typescript.
Working with winston@3.
Can be used with splunk, logstash (ELK) or any other UDP data inputs.
Usage
Installing
using npm:
npm install winston udp-transport-winston --save
using yarn:
yarn add winston udp-transport-winston
Example
import winston = require('winston');
import { UDPTransport } from 'udp-transport-winston';
const logger: winston.Logger = winston.createLogger({
level: 'info',
transports: [
new UDPTransport({
host: 'localhost',
port: 1234
})
]
});
or:
import winston = require('winston');
import { UDPTransport } from 'udp-transport-winston';
const logger: winston.Logger = winston.createLogger({
level: 'info'
});
logger.add(new UDPTransport({
host: 'localhost',
port: 1234
}));
API
class UDPTransport
constructor(options:TransportOptions)
options.host:string
UDP hostoptions.port:number
UDP port- (optional)
options.trailingLineFeed:boolean
if to make single line - (optional)
options.trailingLineFeedChar:string
character to separate messages - (optional) Inherited transport options:
options.format
,options.level
,options.silent
,options.handleExceptions
Made by @raz6tamir