by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 15:14
    indexzero commented #1498
  • Jan 31 2019 15:13
    indexzero commented #1498
  • Jan 31 2019 15:04
    kbirger commented #1498
  • Jan 31 2019 13:01
    indexzero commented #1591
  • Jan 31 2019 13:01
    indexzero closed #1591
  • Jan 31 2019 12:59
    papandreou commented #1591
  • Jan 31 2019 10:41
    papandreou commented #1591
  • Jan 31 2019 10:40
    kibertoad commented #1591
  • Jan 31 2019 09:50
    papandreou opened #1591
  • Jan 30 2019 23:01
    DanielRuf opened #1590
  • Jan 30 2019 16:33
    ahce edited #1588
  • Jan 30 2019 16:32
    ahce closed #1587
  • Jan 30 2019 16:32
    ahce commented #1587
  • Jan 30 2019 15:29
    ColinMorris83 commented #1577
  • Jan 30 2019 15:07
    indexzero commented #1577
  • Jan 30 2019 14:56
    ColinMorris83 commented #1577
  • Jan 30 2019 14:33
    sapsaldog commented #1501
  • Jan 30 2019 14:30
    kibertoad commented #1501
  • Jan 30 2019 14:29
    sapsaldog commented #1501
  • Jan 30 2019 14:28
    kibertoad commented #1577
iamkenos
@iamkenos
hi folks, im migrating to winston 3
i noticed that doing logger.verbose("my message and ", foo); now prints my message and while it used to print my message and foo value in winston 2
how can i configure my logger to print the args after the message?
tagyoureit
@tagyoureit
I have a (long) outstanding PR (winstonjs/logform#85) and Issue (https://github.com/winstonjs/winston/issues/1408) for this. Unfortunately it hasn't been merged yet. Best thing to do is add the token placeholder or switch to using ES6 template literals.
cloverb
@cloverb
@DABH thank you for merging that PR! I was just wondering when you might cut the v2.2.0 release with it?
bsmerbeckuri
@bsmerbeckuri

Hey guys...I have a question which I imagine is heard a lot.
I was trying to set up winston so that I could create different mailing lists for notifications. So one list would be user interactions, one would be system events, one would be security events, etc. However, I've gotten hung up on the functionality of winston where a log of a lower priority (higher number) contains the entries of the higher priority. From what I can see, the only way to solve this would be to have a logger for each of these different style of events.

If I were to do that, however, I wouldn't be able to get the benefits from the debug(info) level. So....i don't know I'm just kind of conflicted as to how to accomplish this implementation

The whole idea was to use the logger with transports per level so that i'd have a .csv file corresponding with each level to email to it's respective mailing list.
bsmerbeckuri
@bsmerbeckuri
Solved it, for anyone looking it's the format syntax
function filterOnly(level) {
  return format(function (info) {
    if (info[LEVEL] === level) {
      return info;
    }
  })();
}

const logger = createLogger({
  format: zformat,
  transports: [
    // only 'info' level
    new transprts.File({
      level: 'info',
      format: filterOnly('info'),
      filename: 'logs/access.log',
    }),
    // any level below 'verbose'
    new transports.File({
      level: 'verbose',
      format: filterOnly('verbose'),
      filename: 'logs/combined.log',
    })
  ]
});
David Hyde
@DABH
@cloverb I (finally) published v2.2.0 for winston-syslog on npm. Let me know if you have any issues!
@bsmerbeckuri yeah, there's a similar solution at https://stackoverflow.com/a/56918394/4451284 . Seems reasonable to me
Fabian Te
@FabianTe
Hi everyone! I've got a question regarding the creation of lots of logger instances:
How would you deal with "class loggers" as in log4j or similar frameworks?
I am running into the issue described in https://github.com/winstonjs/winston/issues/1334# and I wonder how to avoid having to create lots of logger instances.
One solution seems to be to create a proxy object that populates metadata (a label in my case) and to simply use only one logger instance. Is that the recommended way of doing this?
David Hyde
@DABH
Why would you need a lot of loggers? To have different default metadata objects? You could try using child loggers for that? However, personally I’d try to use one logger and have a custom formatter do the heavy lifting / inserting custom stuff into my log messages. Not sure of the details of your use case though
Ahmet Çevik
@ahmetceviik
0|shard | TypeError: self._addDefaultMeta is not a function
0|shard | at pbotClient.DerivedLogger.(anonymous function) (/root/pbot/node_modules/winston/lib/winston/create-logger.js:80:14)
Why error?
Lean Junio
@leanjunio
Hey guys, idk if I'm missing anything but winston is not really logging anything, https://github.com/leanjunio/sequelize-practice/blob/master/index.js#L23, I used the example code from winston's docs
Sander Steenhuis
@Redsandro
Any winston-gitter-webhook module?
Fermin Hudson
@ferminhn87_twitter
hey guys, was wondering.. if I want to use child-logger capability (e.g. for requestId logging through-out the processing pipeline) but don't have to pollute all of the functions with an extra parameter.. does nodejs have a solution for this? how do you guys handle it?
Joe
@josephjaniga
I attempted to get started working on a project, I confirmed it is running winston@3.2.1 and currently still seeing TypeError: Cannot read property 'simple' of undefined referencing winston.format.simple()... Google tells me plenty of people were seeing this error following the wrong version of the docs on the v2.x version of winston. npm ls winston confirms I am runnning 3.2.1 - Any thoughts? please and thanks
Wilson López
@wlopez-enkoding
What do I need to do to be able to send "defaultMeta" to the logs ?
Please help !
createLogger({
    level: 'info',
    format: format.combine(
      format.timestamp({
        format: 'YYYY-MM-DD HH:mm:ss',
      }),
      format.errors({ stack: true }),
      format.splat(),
      format.json()
    ),
    defaultMeta: {
      name: process.env.npm_package_name,
      version: process.env.npm_package_version,
      environment: process.env.ENVIRONMENT,
    },
    transports: [new transports.File({ filename: 'winston.log' })],
  })
logger.add(
      new transports.Console({
        format: format.combine(format.colorize(), format.simple()),
      })
    )
Wilson López
@wlopez-enkoding
@ethanrubio were you able to print defaultMeta to the logs ?
Wilson López
@wlopez-enkoding
Solved, it only prints defaultMeta when I use logger.error
Stephen Hendricks
@z1haze
anyone know where the documentation regarding the format.errors() is? for such an extensive lib i feel like the documentation is lacking a lot
@wlopez-cl where did you learn what format.errors({ stack: true }) does? I am not able to find the information on this
Stephen Hendricks
@z1haze
my testing the {stack: true} does absolutely nothing to the log result
even setting it to false changes nothing
Adam Lee
@adamlee-ARC
Is winstond still the preferred http transport endpoint?
Looks pretty outdated.
Adam Lee
@adamlee-ARC
Spun up my own http server and hooked a Winston logger into the requests - pretty easy.
Jonas Ulrich
@julrich

Hey everyone. Short question regarding the possibility of hooking into events related to logging messages:
Is there a way to register a handler function somewhere, which will be called for every 'logging'-event? Found some references to such an event on StackOverflow, but was completely unable to get code to run that actually works.

I see there's an _onEvent handler function theoretically bubbling up events from transports to the logger, but only error and warn seem to be passing through that.

Jonas Ulrich
@julrich
I think I figured it out! It's the 'data' event, as per Nodes Transform Stream documentation, which is in use here with objectMode :thumbsup:
elinskytap
@elinskytap
hello, does anyone import daily-rotate-logger-file package and see this error Uncaught TypeError: Cannot set property 'DailyRotateFile' of undefined?
Mohamed El Sayad (Anubis)
@melsayad
Hey everyone, I tried to help by define a new way to configure winston using .json file, please check https://www.npmjs.com/package/winston-sugar
Thomas Chiantia
@TomzBench
Is everybody installing winston by using github master? Is there something going on with a release?
For context I am using typescript and there seems to be a lot of typescript fixes that arent published...
Thomas Chiantia
@TomzBench
@indexzero
Shankar Singh
@Shankar-khati
@here anyone facing this multiple callback issue?? with latest version??
NodeError: Callback called multiple times
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_transform.js", line 82, col 31, in DerivedLogger.afterTransform
return this.emit('error', new ERR_MULTIPLE_CALLBACK());
File "<WORKSPACE>/node_modules/winston/lib/winston/logger.js", line 310, col 7, in DerivedLogger._transform
callback();
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_transform.js", line 177, col 10, in DerivedLogger.Transform._read
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_transform.js", line 164, col 83, in DerivedLogger.Transform._write
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_writable.js", line 409, col 139, in doWrite
{snip} new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_writable.js", line 398, col 5, in writeOrBuffer
doWrite(stream, state, false, len, chunk, encoding, cb);
File "<WORKSPACE>/node_modules/readable-stream/lib/_stream_writable.js", line 307, col 11, in DerivedLogger.Writable.write
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
File "<WORKSPACE>/node_modules/winston/lib/winston/logger.js", line 223, col 12, in DerivedLogger.log
this.write({ [LEVEL]: level, level, message: msg });
Any Workaround or stable version where it is fixed??
nolan
@noolaan
Hey-- how come the default winston transports don't log debug messages?
Or anything other than "info" and "error" types.
Richard Itimi
@itimirichard

Hi, I've recently been getting this warning

(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unpipe listeners added to [File]. Use emitter.setMaxListeners() to increase limit
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [File]. Use emitter.setMaxListeners() to increase limit
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 drain listeners added to [File]. Use emitter.setMaxListeners() to increase limit
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [File]. Use emitter.setMaxListeners() to increase limit
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 finish listeners added to [File]. Use emitter.setMaxListeners() to increase limit
(node:26105) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit

I know there's been some discussions around this in the past, but couldn't find anything definitive in terms of a solution. I currently only use one winston logger instance across my application. I don't see this warning being logged to my log file, so I'm suspecting this might have something to do with the this.setMaxListeners(30) in the Console.js file

tagyoureit
@tagyoureit
If you leave a page and come back you might be accidentally adding the same listener multiple times. I've used emitter.listeners in the past to view all listeners and find accidental duplicates.
Richard Itimi
@itimirichard
How did you use the emitter.listeners precisely?
1 reply
Richard Itimi
@itimirichard
Hey, I still need your help with the above issue. Thanks
Jared
@jaredjacob667
Has anyone here still seen the "self._addDefaultMeta is not a function"error anymore?
I have been getting this VERY randomly. I am using the "winston": "3.2.1" and
"winston-daily-rotate-file": "3.10.0" on node 8.10.
F★
@storyofstella_twitter
Hi, I need some help configuring winston, would be cool if you could have a look at this: https://stackoverflow.com/questions/61525425/configuring-winston-logger