Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad translateTime/localTime output #7

Closed
jimmyolo opened this issue Apr 7, 2018 · 3 comments
Closed

bad translateTime/localTime output #7

jimmyolo opened this issue Apr 7, 2018 · 3 comments

Comments

@jimmyolo
Copy link
Contributor

jimmyolo commented Apr 7, 2018

  1. I clone this repo and run its tests are correct, but use pino-pretty as global cli will get this weird output.
$ echo '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}' |pino-pretty --colorize --translateTime
[2018-35-30 17:03:28.ththth UTC] INFO (42 on foo): hello world

$ echo '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}' |pino-pretty --colorize --translateTime --localTime
[2018-35-31 01:03:28.ststst CST] INFO (42 on foo): hello world

$ echo '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}' |pino-pretty --colorize --translateTime --localTime --dateFormat 'yyyy-mm-dd HH:MM:ss.l o'
[2018-03-31 01:35:28.992 +0800] INFO (42 on foo): hello world

2018-04-07 14-37-20

  1. (not a bug) if we pass dateFormat or localTime args, shoud we implicit enable translateTime ?
@mcollina
Copy link
Member

mcollina commented Apr 7, 2018

I'm not sure what you are proposing. Can you make an example before/after your proposal?

@jimmyolo
Copy link
Contributor Author

jimmyolo commented Apr 7, 2018

@mcollina first question is I got weird output when using pino-pretty as global cli.
second, we can just pass dateFormat or localTime that will translatetime too.

echo '{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}' | pino-pretty

// current
--localTime // [1522431328992] INFO (42 on foo): hello world
--dateFormat 'xx' // [1522431328992] INFO (42 on foo): hello world
-t --localTime // [2018-03-31 01:35:28.992 +0800] INFO (42 on foo): hello world
-t --dateFormat 'xx' // [2018-03-31 01:35:28] INFO (42 on foo): hello world

// propose, don't need to pass -t/--translateTime when -n -d
--localTime // [2018-03-31 01:35:28.992 +0800] INFO (42 on foo): hello world
--dateFormat 'xx' // [2018-03-31 01:35:28] INFO (42 on foo): hello world

jsumners added a commit that referenced this issue Apr 7, 2018
@jsumners
Copy link
Member

jsumners commented Apr 7, 2018

Thank you for catching the error. I have resolved it in v1.0.1. I also went ahead and made dateFormat imply translateTime if a user value has been specified for dateFormat (must be different from the default value).

@jsumners jsumners closed this as completed Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants