Skip to content

printing the date using Formatters doesn't work #456

@lmj0011

Description

@lmj0011

logger.js

const moment = require('moment')
const debug = require('debug')
const log = debug('adonuxt-rp:log [ %s ]', moment().format())
const error = debug('adonuxt-rp:error [ %s ]', moment().format())
debug.log = console.info.bind(console) // https://www.npmjs.com/package/debug#output-streams

const logger = {
  log,
  error
}

module.exports = logger
module.exports.default = logger

I have that module imported throughout my app and is using it like so
logger.log('Successfully created')

The output is not what I expect

  adonuxt-rp:log [ +398ms ] Successfully created

Why is my date output defaulting to the millisecond output?

I'm expecting an output similiar to this:

adonuxt-rp:log [ 2017-05-14T04:08:26-05:00 ] Successfully created

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions