Skip to content

🩹 [Patch]: Cleanup debug/verbose logging #187

@MariusStorhaug

Description

@MariusStorhaug

Describe the change

Shallow logging

Private functions => debug
Public functions => verbose > debug

Get-GitHubUser -Verbose
Get-GitHubOrganization -Debug

Deep logging

Logging from referenced external functions use PowerShell logging preferences to enable deep logging.

$VerbosePreference = 'Continue' 
$DebugPreference = 'Continue'

Have a function that shows invocations

function Get-Caller {
    <#
        .SYNOPSIS
        Shows the caller of the current function.

        .EXAMPLE
        Show-Caller

        Shows the caller of the current function.
    #>
    [outputType([string])]
    [CmdletBinding()]
    param()
    $stack = Get-PSCallStack
    $called = $stack[1].Command
    $caller = $stack[2].Command
    "$caller called $called"
}

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions