Functions/Write-LogApp.ps1

function Write-LogApp {
    [cmdletbinding()]
    param(
        [parameter(Mandatory = $true, Position=0)]
        [ValidateSet("ERROR", "INFO", "SUCCESS")]
        [ValidateNotNull()]
        [string]$Level,
        [parameter(Mandatory = $true, Position=1)]
        [string]$String,
        [parameter(Mandatory = $true, Position=2)]
        [string]$App
    )
    $Date = (Get-Date).ToString("dd.MM.yyyy HH:mm:ss.fff")
    $script:RunningFromFolder = $HOME
    $LogFile = "{0}\{1}_{2}" -f $RunningFromFolder, $App, "Deployment_Log.txt"
    $Date + " | " + $Level + " | "+ $String | Out-File $LogFile -Append
}