Powershell - Simplified Logging
Is there something wrong with my solution? I don't think so.
Have I missed any problems? 


Omitted Information stream, cf How to process Write-Information pipeline output when using SilentlyContinue
The -Debug parameter  overrides the value of the $DebugPreference variable for the current command, setting the value of $DebugPreference to Inquire. Prompts to continue for every Write-Debug statement which may be considered inconvenient (or even harmful) in batch processing.



Here's my solution (partially commented script):

[CmdletBinding()]
param(
   # [switch]$debug   # alternative to [CmdletBinding()]
)

function Split-Streams {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory,ValueFromPipeline)]
        [ValidateNotNull()]   # avoid crashing . property dereference operator
        $InputStream,
        [switch]$revert
    )
    process {
        if ( -not $revert.IsPresent ) {
            # return an object which contains type and value of $InputStream
            [PSCustomObject] @{
                stream = $InputStream.GetType().FullName
                value  = $InputStream
            }
        }
        else {
          # basic input object validity check
          if ( ($InputStream.psobject.Properties.Name -join ',') -match 
                    "\bstream\b.*\bvalue\b|\bvalue\b.*\bstream\b" ) {
            # review split streams and handle them individually
            switch($InputStream.stream)
            {
                'System.Management.Automation.DebugRecord' { 
                    # Do whatever you want, like formatting an writing to a file. 
                    Write-Host ($InputStream.value) -ForegroundColor Gray
                }
                'System.Management.Automation.ErrorRecord' {
                    Write-Host ($InputStream.value) -ForegroundColor Red
                    Write-Host ('Error function: {0}' -f ($InputStream.value).InvocationInfo.MyCommand.Name) -ForegroundColor DarkRed
                }
                'System.Management.Automation.VerboseRecord' { 
                    Write-Host ($InputStream.value) -ForegroundColor Cyan 
                }
                'System.Management.Automation.WarningRecord' { 
                    Write-Host ($InputStream.value) -ForegroundColor Yellow 
                }
                'System.Management.Automation.InformationRecord' { 
                    Write-Host ($InputStream.value) -ForegroundColor Green
                }
                default { 
                    Write-Host "output type: $($InputStream.stream)" -ForegroundColor Blue
                    # keep original output stream unchanged
                    $InputStream.value
                }
            }
          }
        }
    }
}

function Write-Messages
{
    [CmdletBinding()]
    param()
    Write-Debug       "Debug message $DebugPreference"
    Write-Verbose     "Verbose message $VerbosePreference"
    Write-Warning     "Warning message $WarningPreference"
    Write-Error       "Error message $ErrorActionPreference"
    Write-Information "Information message $InformationPreference"

    # Write-Output: it is generally not necessary to use the cmdlet.
                      'Output message'
    #               I'm checking a more complex object than plain string
    Write-Output       $Host
}

$DebugPreferenceSave = $DebugPreference     # backup $DebugPreference
If ($PSBoundParameters['Debug']) {
    # The Debug parameter overrides the value of the $DebugPreference
    #     variable for the current command, setting the value
    #     of $DebugPreference to Inquire.
    # The following setting suppresses asking whether you want to continue
    # even if examined `Write-Messages` is a third-party black box.
    $DebugPreference = 'Continue'
}

Write-Messages -Verbose *&gt;&amp;1 | Split-Streams | Split-Streams -revert

$DebugPreference = $DebugPreferenceSave     # restore $DebugPreference


Alternatively to the (sample) usage in the one pipeline:

Write-Messages -Verbose *&gt;&amp;1 | Split-Streams | Split-Streams -revert


(cf above code) you can call it as follows:

$test3 = Write-Messages -Verbose *&gt;&amp;1 | Split-Streams
# preprocess the $test3 variable here (optional)
$test3 | Split-Streams -revert