NAME
SVN::S4::Debug - Allow debug messages to be easily switched on and off.
SYNOPSIS
use SVN::S4::Debug qw(INFO DEBUG is_debug);
INFO ("informational message");
DEBUG ("debug message") if is_debug>=2;
DESCRIPTION
SVN::S4::Debug functions are used instead of print, to allow control over all log messages work in a unified way.
Debug levels can be controlled globally, or via a per-package $Debug variable that is created automatically. (However, it's more general to test the is_debug method in scripts, unless it is a very hot function.)
Conventions for inside BugVise (but not required by this module) are that debug level 1 is for high-level messages for program debug. Levels 2 and above are for package debug, 2 being common, and above 2 being very verbose.
METHODS
- INFO
-
Print an informational message.
- DEBUG
-
Print a debug message.
- debug_option switch
-
Enable debug on all modules, based on the command line argument passed. This is typically called from a Getopt::Long parser. Options supported are: "--debug" will set debug level 1 globally, and "--debugi {level}" will set the global debug level to the specified value. "--debugi {package}:{level}" to set debug on one package, and will also work on any package that uses a $Debug variable.
- global_debug level
-
Enable debug on all modules.
- is_debug
-
Return current debug level, or zero if not enabled.
- package_debug level
-
Enable debug on the current package.
- show_deltas flag
-
If true, print timestamps as relative to the last printout.
ENVIRONMENT
- BUGVISE_DEBUG
-
If set, parse the contents of BUGVISE_DEBUG as a debug_option() at package start time.
DISTRIBUTION
Copyright 2007-2017 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>