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

feat(logging): add timestamp #48

Merged
merged 8 commits into from
Sep 19, 2020
Merged

feat(logging): add timestamp #48

merged 8 commits into from
Sep 19, 2020

Conversation

wuruochong
Copy link
Contributor

Description

Added time to end of each line. Helps identify if program hangs.

Testing

Ran program with both out of stock and fake in stock messages. Verified that time is at the end of each line.

@vp-regular
Copy link
Contributor

A quick google suggests you can just change the Logger itself instead. It shouldn't be the responsibility of lookup to keep track of the time in my opinion.

https://stackoverflow.com/questions/10271373/how-can-i-add-timestamp-to-logs-using-node-js-library-winston

@wuruochong
Copy link
Contributor Author

A quick google suggests you can just change the Logger itself instead. It shouldn't be the responsibility of lookup to keep track of the time in my opinion.

https://stackoverflow.com/questions/10271373/how-can-i-add-timestamp-to-logs-using-node-js-library-winston

Good point, moved it to logger.

previous version did not correctly update time. now fixed
@wuruochong wuruochong marked this pull request as draft September 19, 2020 05:25
src/logger.ts Outdated Show resolved Hide resolved
@wuruochong wuruochong marked this pull request as ready for review September 19, 2020 05:30
@admon84
Copy link
Contributor

admon84 commented Sep 19, 2020

@wuruochong I tried making a similar change with Logger native format.timestamp() but I couldn't get passed a lint error with the template literal: https://github.com/jef/nvidia-snatcher/pull/51/files

Either way, I like this format having the timestamp consistently on the front of the line, like you have it in your latest commit.

@admon84 admon84 mentioned this pull request Sep 19, 2020
@jef
Copy link
Owner

jef commented Sep 19, 2020

@wuruochong I tried making a similar change with Logger native format.timestamp() but I couldn't get passed a lint error with the template literal: #51 (files)

Either way, I like this format having the timestamp consistently on the front of the line, like you have it in your latest commit.

I too was doing this originally, but decided just to leave it out without hackin' up the timestamp type. I think at this point we definitely need timestamps.

Copy link
Owner

@jef jef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Looks great 🚀 😄

@jef jef changed the title feat: Added time to each line feat(logging): add timestamp Sep 19, 2020
@jef jef merged commit 6c3cd01 into jef:main Sep 19, 2020
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

Successfully merging this pull request may close these issues.

None yet

5 participants