Simple logging with dynamic scoping

Run Settings
LanguageRaku
Language Version
Run Command
sub log($msg) { &*log($msg); } sub add-numbers($x, $y) { log("Adding $x and $y"); $x + $y; } sub multiply-numbers($x, $y) { log("Multiplying $x and $y"); $x * $y; } sub my-program($x, $y) { say add-numbers($x, $y); say multiply-numbers($x, $y); } sub MAIN() { my &*log; say "\n", 'No logging at all.'; &*log = -> $msg { }; my-program(1, 2); say "\n", 'Log only additions (filtering).'; &*log = { .say if m/Adding/ }; my-program(1, 2); say "\n", 'Log in all caps.'; &*log = { .uc.say }; my-program(1, 2); say "\n", 'Log all messages.'; &*log = &say; my-program(1, 2); }
Editor Settings
Theme
Key bindings
Full width
Lines