Skip to content

fix(Invoke-Logging): Warn-effect logging silently does nothing — Warn vs Warning key mismatch #15

@HeyItsGilbert

Description

@HeyItsGilbert

Summary

The Effect enum defines Warn. The Configuration.psd1 Logging section uses the key Warning. Invoke-Logging looks up $config.Logging.$Effect — when Effect is Warn, it looks up Logging.Warn which doesn't exist. The lookup returns $null, the Enabled check fails, and Warn-effect logging is silently skipped every time.

Files

  • Gatekeeper/Private/Invoke-Logging.ps1:14
  • Gatekeeper/Configuration.psd1
  • guides/logging.md:80 (also uses the wrong key in the example)

Root Cause

# Configuration.psd1
Logging = @{
    Warning = @{ Enabled = $false; Script = {...} }   # key is 'Warning'
}

# Invoke-Logging.ps1
$logSettings = $config.Logging.$Effect   # when $Effect = 'Warn', looks up 'Warn' → $null

Fix

Rename the config key WarningWarn to match the Effect enum (the enum is the typed source of truth). Update Configuration.psd1, any user-facing config documentation, and the logging guide example.

Notes

  • Also affects guides/logging.md:80 which uses $config.Logging.Warning.Enabled = $true — a silent no-op
  • Found by Sage Nakamura, DualCore, and Shawn Wee!-ler

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions