PS Standard.ps1

From vwiki
Revision as of 13:56, 18 April 2012 by Sstrutt (talk | contribs) (Re-orged categories)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
# ======================================================
# 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)
#}