Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
OpenXPKI::Debug(3)    User Contributed Perl Documentation   OpenXPKI::Debug(3)

Name
       OpenXPKI::Debug - central debugging class of OpenXPKI.

Description
       This is the central debugging module of OpenXPKI. If you	write a	new
       module then you can include it by simply	making an appropriate use
       statement:

       use OpenXPKI::Debug;

       It is not necessary to remove this line if you don't debug your code.
       The activation of the debugging statements is handled by	some static
       variables of the	debug module. If you want to debug your	code then you
       have to do the following.

       1. Include some debug statements	into your module code:
	   my $variable	= "some	critical content"; ##! 2: $variable

	   A debug statement must be started with "\s*##!". The	next number
	   specifies the debug level. It has to	be a power of 2. Higher	levels
	   mean	more messages.	If the message is important then you should
	   choose a small number bigger	than zero. The colon is	a separator.
	   After the colon the code follows which will be executed.

	   If later on you set debug level 1 for this module then the above
	   message will	not be displayed. If you set level 4 the message will
	   be displayed.

       2. Use your module:
	   Add the following lines to the startup script:

	       use OpenXPKI::Debug;
	       $OpenXPKI::Debug::BITMASK{'MyM.*'} = 0b1010; # BITMASK: show level 2 and	8 messages
	       # $OpenXPKI::Debug::LEVEL{'MyM.*'} = 4;	    # LEVEL: show messages up to level 4

	       require MyModule; ## or require a module	which use my Module

	   In practice you will	only have to add the BITMASK or	LEVEL line
	   because "require" is	used to	load the server	which does the rest
	   for you.

	   Please remember to not implement a "use" statement before you run
	   "require" after you specified the debug level. This debug module
	   manipulates the code	parsing	of Perl!

Functions
   import
       Executed	if you "use" or	"require" this module in another module.
       Checks if debugging is activated	for the	calling	module and decides
       whether a source	filter has to be applied or not.

   filter
       Implements the source filtering.

       This function will only be used if the debugging	was activated by the
       import function.	Please see Filter::Util::Call for more details.

   debug
       Build the debug message.	Also output debug level, module	name and
       source code line.

   __censor_msg
       Censor debug messages that potentially contain confidential information
       such as passwords or private keys.

   __level_to_bitmask
       Converts	a maximum debug	level to a bitmask. The	bitmask	will be	the
       minimum value that includes the given level and where all bits are set.

	   7  => 111  (7)
	   8  => 1111 (15)
	   12 => 1111 (15)

See also
       Filter::Util::Call

perl v5.32.0			  2020-08-29		    OpenXPKI::Debug(3)

Name | Description | Functions | See also

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=OpenXPKI::Debug&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help