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

v1.1.1 - Add a logger option to print timestamps in UTC for log traces #15

Merged
merged 1 commit into from
Jan 27, 2017
Merged

Conversation

HowardWolosky
Copy link
Member

@HowardWolosky HowardWolosky commented Jan 26, 2017

Write-Log is used for writing all messages to the console and the log file.
It embeds a timestamp with each message, but this timestamp uses LocalTime.
A request has come in to optionally allow users to have this timestamp
recorded in UTC instead of LocalTime.

This adds a new global variable $global:SBUseUTC that defaults to $false.
If set to $true, then Write-Log will use UTC for the timestamps.

The documentation has been updated to reflect this new
configuration option.

  • Additionally fixed a typo in Write-Log where it was trying to
    call Write-Debug.

Resolves #10: Add a logger option to print timestamps in UTC for log traces

@msftclas
Copy link

Hi @HowardWolosky-MSFT, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Howard Wolosky). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

{
$dateString = $date.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss")
}

Copy link
Contributor

@danbelcher-MSFT danbelcher-MSFT Jan 26, 2017

Choose a reason for hiding this comment

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

It looks like both the Local Time and UTC are being presented in the same format.  How can we tell if a given log file uses UTC or Local Time? Are we logging the value of $global:SBUseUTC?

Copy link

Choose a reason for hiding this comment

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

You can also use the 'Z' postfix or offsets for the timestamps: http://www.w3.org/TR/NOTE-datetime

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion. Done.

Write-Log is used for writing all messages to the console and the log file.
It embeds a timestamp with each message, but this timestamp uses LocalTime.
A request has come in to optionally allow users to have this timestamp
recorded in UTC instead of LocalTime.

This adds a new global variable $global:SBUseUTC that defaults to $false.
If set to $true, then Write-Log will use UTC for the timestamps, appending
a "Z" to the end of the timestamp based on http://www.w3.org/TR/NOTE-datetime.

The documentation has been updated to reflect this new
configuration option.

* Additionally fixed a typo in Write-Log where it was trying to
call Write-Debug.

Resolves #10: Add a logger option to print timestamps in UTC for log traces
@HowardWolosky HowardWolosky merged commit 0291aff into microsoft:master Jan 27, 2017
@HowardWolosky HowardWolosky deleted the fix/utc branch January 27, 2017 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a logger option to print timestamps in UTC for log traces
4 participants