Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MariusStorhaug opened this issue Dec 5, 2024 · 0 comments · May be fixed by #207
Open

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

MariusStorhaug opened this issue Dec 5, 2024 · 0 comments · May be fixed by #207
Labels

Comments

@MariusStorhaug
Copy link
Contributor

MariusStorhaug commented Dec 5, 2024

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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

1 participant