winstonjs / winston-syslog

A syslog transport for winston
http://github.com/winstonjs/winston-syslog
MIT License
135 stars 123 forks source link

Always getting error "Cannot log unknown syslog level" #97

Open MukilanP opened 6 years ago

MukilanP commented 6 years ago

Hi All, I am always getting error "Cannot log unknown syslog level". When i look into the code, the following code snippet is reason for this error

if (!~levels.indexOf(info[LEVEL])) { return callback(new Error('Cannot log unknown syslog level: ' + info[LEVEL])); }

Can you please provide simple working sample?

Regards, Mukilan

MukilanP commented 6 years ago

The following sample code i tried

`var winston = require('winston') require('winston-syslog').Syslog;

winston.setLevels(winston.config.syslog);

var logger = new (winston.Logger)({ //levels: winston.config.syslog.levels, transports: [ new (winston.transports.Syslog)({ host:'localhost', port: 514, level:'debug' }) ] });

logger.debug('Hello distributed log files!')`

vlastoun commented 6 years ago

I am getting the same error.

TuxGit commented 6 years ago

same error with key warn

vlastoun commented 6 years ago

I have winston 2 and it started to work when i downgraded winston-syslog to version 1.2.6

gigi commented 6 years ago

The same thing

Jesspu commented 5 years ago

Having the same issue

`'use strict';

const os = require('os'); const winston = require('winston'); require('winston-syslog').Syslog;

/**

/**

/**

/**

/**

/**

/**