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

Request for giving access to time variable in Logger.timeEnd() #102

Closed
MuneebNaveed opened this issue Aug 21, 2020 · 1 comment
Closed

Comments

@MuneebNaveed
Copy link

I am currently using

logger.time('Powers Fetched');
setTimeout(() => {
    ...
    logger.timeEnd('Powers Fetched');
}, 1500);

but it gives me ugly decimal numbers like 1514.76513671875ms

My proposal is to give us access to the time variable, maybe as a callback as second paramter or an optional config object, so we can set the decimal points, change unit, etc. If something like this already exists, please shed some light on it.

@jonnyreeves
Copy link
Owner

hey @MuneebNaveed, glad you are finding use for this lib. The 'time' methods were originally formatted to be consistent with Chrome's output:

Screenshot 2020-08-21 at 16 25 56

If you really want to reformat this, you could consider raising a diff which adds a 'timeFormatter' func to the defaultLogHandler options object; although I'm not sure if this would provide value to others users (and therefore may be best resolved by you forking and vendoring this library)

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

2 participants