Adds a space to the beginning of the message #9

Closed
brihogan opened this Issue May 18, 2012 · 4 comments

Projects

None yet

4 participants

For some reason my messages all have two spaces at the beginning (level and meta are normal). I'm assuming this is via this module as logging to a file and the console work just fine.

Example:
"message": " This is a message"

Upon a quick inspection of your code I don't see where the spaces could be added, so I wonder if it's an issue with the mongodb driver or something in my system? It's just strange that it's adding it to message but nothing else.

Owner

Not really sure. I don't actively use this module in production, but I know others do. @yosefd?

Contributor
yosefd commented May 22, 2012

I doesn't come from mongodb transport module. Spaces might be created somewhere in Winston upon formatting. I remember I once saw the code that pads additional spaces to align messages given different length of error level title (e..g. "info" vs "error").

In a way I use winston and this transport, I don't experience such problem. This what I do:

     var mongotransport = new winston.transports.MongoDB({
        host: cfg.host,
        port: cfg.port,
        collection: cfg.collection,
        db: cfg.database,
        handleExceptions: true,
        level: options.level.remote
      });
      var logger = new winston.Logger({
        transports: [
                ...other transports here...,
                mongotransport
            ]
      });
      logger.padLevels = false; // do not pad levels

Setting padLevels to false should solve this.

Member
39dotyt commented Aug 28, 2013

There is no spaces for me, too.

@39dotyt 39dotyt closed this Sep 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment