Public/Utilities/Write-Eden.ps1

function Write-Eden {
    #[System.Diagnostics.CodeAnalysis.SuppressMessage('PSAvoidUsingWriteHost', '', Scope='Function')]
    [CmdletBinding()]
    param(
        [String] $Message,
        [String] $LoggingPrefix,
        [String] $Color,
        $Settings,
        [Parameter(ValueFromPipeline=$true)]
        [String] $pipedValue
    )
    Begin {
        if ($null -ne $Settings) {
            $loggingPrefix = "$($settings.SolutionName) $($settings.ServiceName) $($settings.Name) $($LoggingPrefix)"
        }

        $prefix = "$(Get-Date -UFormat "%Y-%m-%d %H:%M:%S") $($LoggingPrefix): "
        if ($null -eq $LoggingPrefix -or [String]::IsNullOrEmpty($LoggingPrefix)) {
            $prefix = ""
        }
    }

    Process {
        $outFile = $null -ne $Settings -and $null -ne $Settings.EdenOutputFile -and ![String]::IsNullOrEmpty($Settings.EdenOutputFile)
        if ($null -eq $Message -or [String]::IsNullOrEmpty($Message)) {
            # Write-Host "1"
            foreach ($line in $pipedValue) {
                Write-Host "$prefix$($line)" -ForegroundColor $Color
                if ($outFile) {
                    "$prefix$($line)" | Out-File -FilePath $Settings.EdenOutputFile -Append -Force
                }
            }
        } else {
            # Write-Host "2"
            if ($outFile) {
                "$prefix$Message" | Out-File -FilePath $Settings.EdenOutputFile -Append -Force
            }
            Write-Host "$prefix$Message" -ForegroundColor $Color
        }
    }
}
New-Alias `
    -Name e-uw `
    -Value Write-Eden `
    -Force