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

Enhancement: timestamp format option #27

Open
aabuhijleh opened this issue May 11, 2021 · 0 comments
Open

Enhancement: timestamp format option #27

aabuhijleh opened this issue May 11, 2021 · 0 comments

Comments

@aabuhijleh
Copy link

To get the timestamp format I want, I'm overriding the formatDate function on the Debugout instance

This works ok for me but this approach is not documented and maybe passing a format string as an option would be more appropriate

import { Debugout } from "debugout.js";
import dateformat from "dateformat";

export const logger = new Debugout({
  realTimeLoggingOn: true,
  useTimestamps: true,
});

logger.formatDate = (ts = new Date()) => {
  return `[${dateformat(ts, "yyyy-mm-dd hh:MM:ss")}]`;
};
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

1 participant