PS Standard.ps1

From vwiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
# ======================================================
# Standard include library (logging etc)
# ======================================================
# Simon Strutt        Nov 2010
# ======================================================
#
# Version 1
# - Initial Creation
#
# Version 2
# - Added error logger
#
# ======================================================

$RGB_RED = "#ff3300"
$RGB_AMBER = "#ff9900"
$RGB_GREEN = "#66ff99"

function Log ($text) {
    [int]$duration = (New-TimeSpan $start (Get-Date)).TotalSeconds
    Write-Host "$duration secs | $text"
}

function Log-NoNewLine ($text) {
    [int]$duration = (New-TimeSpan $start (Get-Date)).TotalSeconds
    Write-Host "$duration secs | $text" -nonewline
}

#function Log-Error($text) {
#    if (!$ErrorLog) {
#        $ErrorLog = @()
#    }
#    $ErrorLog += $text
#    Log ("ERROR: " + $text)
#}