Skip to content

Changing to UTC #203

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

Merged
merged 1 commit into from
Oct 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions adapter/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Logger {

log(msg: string, level = LogLevel.Log): void {
if (this._prependTimestamp) {
msg = this._formatTimeString() + ":: " + msg;
msg = "[" + this._formatTimeString() + "] " + msg;
}
msg = msg + '\n';
this._write(msg, level);
Expand Down Expand Up @@ -93,11 +93,11 @@ export class Logger {

private _formatTimeString(): string {
let d = new Date();
let hourString = this._padZeroes(2, String(d.getHours()));
let minuteString = this._padZeroes(2, String(d.getMinutes()));
let secondString = this._padZeroes(2, String(d.getSeconds()));
let millisecondString = this._padZeroes(3, String(d.getMilliseconds()));
return hourString + ":" + minuteString + ":" + secondString + '.' + millisecondString;
let hourString = this._padZeroes(2, String(d.getUTCHours()));
let minuteString = this._padZeroes(2, String(d.getUTCMinutes()));
let secondString = this._padZeroes(2, String(d.getUTCSeconds()));
let millisecondString = this._padZeroes(3, String(d.getUTCMilliseconds()));
return hourString + ":" + minuteString + ":" + secondString + '.' + millisecondString + " UTC";
}

/**
Expand Down Expand Up @@ -134,8 +134,10 @@ export class Logger {
this._prependTimestamp = false;

// Log the date and start time at the top
const timestamp = new Date().toLocaleDateString() + ", " + this._formatTimeString();
this.verbose(timestamp);
let d = new Date();
let dateString = d.getUTCFullYear() + "-" + `${d.getUTCMonth() + 1}` + "-" + d.getUTCDate();
const timeAndDateStamp = dateString + ", " + this._formatTimeString();
this.verbose(timeAndDateStamp);
}
}

Expand Down