Pino: "timestamp" option is ignored in Browser environment

Created on 5 Sep 2020  路  3Comments  路  Source: pinojs/pino

Hi, thank you for the great library.

I've run the following code.

I expected time should become ISO String, but actually the output is still epochTime.

import pino from 'pino'

const logger = pino({
  timestamp: () => `,"time":"${new Date(Date.now()).toISOString()}"`,
  browser: {
    asObject: true,
  },
})

logger.info('Running app')

image

is this intensional? Thanks in advance.

Most helpful comment

Yes

All 3 comments

Yes, this is intentional. In the browser some of the internals are different :( and we cannot have the same features. We might want to add something analog to this. Would you like to send a PR?

@mcollina

Thanks for the reply. The code is located here, right? I'll try to work on it :)

https://github.com/pinojs/pino/blob/master/browser.js#L211

And it looks like passing opts.timestamp to wrap will add customization capability.

https://github.com/pinojs/pino/blob/master/browser.js#L177

Yes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dunklesToast picture dunklesToast  路  3Comments

grbr picture grbr  路  6Comments

JamesKyburz picture JamesKyburz  路  7Comments

afgallo picture afgallo  路  4Comments

lioaslan picture lioaslan  路  3Comments