Logging & Console Output Style
Consistent, scannable console output helps contributors quickly understand build and utility script progress. This guide defines the canonical emoji/icon and wording conventions. Use these for Write-Host
or future Write-KrLog
helper calls.
Icon Map
Category | Emoji | Usage Examples |
---|---|---|
Info / Generic | βΉοΈ | General informational messages |
Build / Compile | ποΈ | Building solution / project |
Restore / Fetch / Download | π¦ | Restoring packages, downloading tooling |
Update / Sync | π | Syncing DLLs, updating analysis packages |
Clean / Purge | π§Ή | Cleaning artifacts, coverage, docs |
Test (start) | π§ͺ | Starting test suites |
Test (sub-step) | βΆοΈ | Per-framework test run indicator |
Packaging / Archive | π¦ | Creating NuGet/package artifacts |
Format | β¨ | Code formatting operations |
Coverage (collect) | π | Collecting or saving raw coverage XML |
Coverage (report) | π | Generating HTML / badges coverage reports |
Documentation (aggregate) | π | Generating all docs/help bundles |
Documentation (PowerShell) | π | PowerShell help generation |
Documentation (C# API) | π | C# XML β Markdown API docs |
Install / Deploy | π | Deploying / installing module |
External Tool Install | π₯ | Installing tools (xmldocmd, ReportGenerator) |
Large File Generation | π§ͺ | Creating synthetic test files |
Copy / File Ops / Stage | π | Copying/staging binaries, assets |
Third-Party Notices | π | Generating license / notice files |
Manifest / Config | π | Generating or updating config/manifest |
Scan / Discovery | π | Scanning directories, locating files |
Success / Final | β | Successful completion summary |
Warning | β οΈ | Non-fatal issue / degraded path |
Error / Failure | β | Fatal error / abort condition |
Removal / Deletion | ποΈ | Deleting modules, temp, artifacts |
Formatting Rules
- Start each primary status line with the emoji then one space.
- Use sentence case; prefer gerund verbs for ongoing work (βBuildingβ, βGeneratingβ).
- Keep ellipses (
...
) only for clearly ongoing operations; omit otherwise. - One emoji per line; do not chain multiples.
- Allow a blank line before a final β success message if prior output is dense.
- Leave streamed progress markers (e.g.
#
) untouched. - Do not substitute different but similar emojis; stay canonical.
- For non-Unicode terminals, a future
-NoEmoji
orKESTRUN_NO_EMOJI
suppression may be added.
Before / After Example
Before:
Write-Host 'Building solution...'
Write-Host 'Running tests for net9.0'
Write-Host 'Coverage (Cobertura) saved: X'
After:
Write-Host 'ποΈ Building solution...'
Write-Host 'π§ͺ Running tests for net9.0'
Write-Host 'π Coverage (Cobertura) saved: X'
Suggested Helper (Future)
Centralize formatting and allow emoji suppression:
function Write-KrLog {
param(
[Parameter(Mandatory)][string]$Message,
[ValidateSet('info','build','restore','update','clean','test','package','format','coverage','report','docs','docs-pwsh','docs-cs','install','tool','generate','copy','notice','manifest','scan','success','warn','error','remove')]
[string]$Kind = 'info',
[switch]$NoEmoji
)
$map = @{ info='βΉοΈ'; build='ποΈ'; restore='π¦'; update='π'; clean='π§Ή'; test='π§ͺ'; package='π¦'; format='β¨'; coverage='π'; report='π'; docs='π'; 'docs-pwsh'='π'; 'docs-cs'='π'; install='π'; tool='π₯'; generate='π§ͺ'; copy='π'; notice='π'; manifest='π'; scan='π'; success='β
'; warn='β οΈ'; error='β'; remove='ποΈ' }
$useEmoji = -not ($NoEmoji -or $env:KESTRUN_NO_EMOJI)
$icon = if ($useEmoji) { $map[$Kind] } else { '' }
if ($icon) { Write-Host "$icon $Message" } else { Write-Host $Message }
}
Adoption optional; recommended for future consistency.
Migration Checklist
- Replace non-canonical or duplicate emojis
- Ensure gerund verb style for active operations
- Use β
for final success; β for failures (plus
throw
) - Leave streaming progress markers intact
- Avoid mixing packaging vs restore icons (both use π¦ intentionally)
Last updated: 2025-09-03