Cookbook
Topics |
Debug MessagesSummary: A
function dmsg() for use in debugging PmWiki recipesVersion: 2024-01-14
Prerequisites: PmWiki 2.3.32; PHP 8
Status: In use
Maintainer: skiwi
Categories: Markup PmWiki Developer
Discussion: DebugMessages-Talk
Questions answered by this recipeWhen I am writing a PmWiki recipe how can I quickly and easily display user friendly debug information from the recipe? DescriptionThis recipe provides a simple The recipe provides a function $smsgprefix : the prefix to the debug output line or block
$smsgdata : the data, of any type, to be dumped in human friendly format
$smshtml : optional boolean value for when $smsgdata contains preformatted HTML to be passed through
$dmsgId : optional string value
This recipe is inspired by the code snippet in Cookbook:Debugging For Cookbook Authors, and provides an enhanced, tried and tested, reusable version of this. Installation
UsageThe recipe provides a page variable ConfigurationIn the recipe that is using if (!function_exists('dmsg')) { function dmsg (string $smsgprefix, $smsgdata) { # local instance global $MessagesFmt; if (!isset ($MessagesFmt['functionName'])) $MessagesFmt['functionName'] = []; $MessagesFmt['functionName'] [] = $smsgprefix . ': ' . \PHSC (strval($smsgdata)); } }replacing " functionName " with a unique identifier of your choosing.
This will ensure that whether or not the The recipe will use the parameter
Change log / Release notes2024-04-10 Update for PHP 8 warnings 2024-01-14 Initial version See alsoOn PmWikiFrom the PmWiki developer category:
ContributorsSpecial thanks to Petko and the PmWiki documenters. TalkbackSee discussion at DebugMessages-Talk |
tahi Page last modified on 2024 Apr 11 22:30
Edit - History - Recent Changes - WikiHelp - Search - email page as link -> mailto:?Subject="KiwiWiki: Debug Messages"&Body=