PS Standard.ps1

From vwiki
Revision as of 18:15, 21 March 2011 by Sstrutt (talk | contribs) (Initial creation)
(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)
#}