home *** CD-ROM | disk | FTP | other *** search
- package Autodoc::LogDebug;
-
- ###############################################################################
- ###############################################################################
- ##
- ## Written by Adam Swift (c) 1995 by Friday Software and Consulting
- ## All rights reserved.
- ##
- ## This notice may not be removed from this source code.
- ##
- ## This program is included in the MiscKit by permission from the author
- ## and its use is governed by the MiscKit license, found in the file
- ## "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- ## for a list of all applicable permissions and restrictions.
- ##
- ## Because AutoDoc is licensed free of charge, there is no warranty
- ## for the program. Copyright holder, Friday Software and Consulting,
- ## is providing this program "as is" and this program is distributed in
- ## the hope that it will be useful, but WITHOUT ANY WARRANTY; without
- ## even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- ## PARTICULAR PURPOSE.
- ##
- ###############################################################################
- ###############################################################################
-
- require 5.000;
-
- ##########################
- # load required packages #
- ##########################
- use Exporter;
-
- @ISA = qw(Exporter);
- @EXPORT = qw(dblog
- dblog_debuglevel
- set_dblog_debuglevel);
-
- $module_version = '$Revision: 1.2 $';
- $module_version =~ s!(\$\w+: | \$)!!g;
- $module_id = '$Id: LogDebug.pm,v 1.2 1995/10/20 22:16:27 aswift Exp $';
- $module_id =~ s!(\$\w+: | \$)!!g;
- $module_name = $module_id;
- $module_name =~ s!^([^\,]+).*$!$1!;
-
- ############################################################################
- #
- # Purpose: Module that encapsulates logging formatted debugging messages
- #
- # HISTORY: START
- # $Log: LogDebug.pm,v $
- # Revision 1.2 1995/10/20 22:16:27 aswift
- # Added DevMan style changes Log support
- #
- #
- # HISTORY: END
- ############################################################################
-
- #############################################################################
- #
- # NAME: module_version
- #
- # ACTION: returns the version number of this module
- #
- # RETURN: the module version
- #
- #############################################################################
- sub module_version
- {
- return $module_version;
- }
-
- sub module_versionstamp
- {
- return "$module_name (rev-$module_version)";
- }
-
- #############################################################################
- #
- # NAME: set_dblog_debuglevel
- #
- # ACTION: Sets a global variable which determines the threshold debugging
- # level to produce output to stderr in dblog()
- #
- # GLOBALS: The debugging level $LogDebug_debuglevel
- #
- # ARGUMENTS: A log debugging level
- #
- #############################################################################
- sub set_dblog_debuglevel
- {
- $DebugLog_debuglevel = $_[0];
- }
-
-
-
- #############################################################################
- #
- # NAME: dblog_debuglevel
- #
- # ACTION: Returns the value of the global variable which determines the
- # threshold debugging level to produce output to stderr in dblog()
- #
- # GLOBALS: The debugging level $LogDebug_debuglevel
- #
- # RETURN: The log debugging level
- #
- #############################################################################
- sub dblog_debuglevel
- {
- return 0 if (!defined($DebugLog_debuglevel));
- return $DebugLog_debuglevel;
- }
-
-
-
- #############################################################################
- #
- # NAME: dblog
- #
- # ACTION: If the debugging level is set higher than the number in the
- # first argument then the remaining arguments are printed
- # to stderr
- #
- # GLOBALS: The debugging level $LogDebug_debuglevel
- #
- # ARGUMENTS: A log debugging level
- # A list of debugging messages
- #
- #############################################################################
- sub dblog
- {
- local ($loglevel, $counter, $logstars);
-
- $loglevel = shift @_;
-
- $logstars = "";
- if (&dblog_debuglevel() > $loglevel) {
- if ($loglevel > 0) {
- for ($counter = 6; $counter > $loglevel; $counter --) {
- $logstars .= "*";
- }
- } else {
- for ($counter = 0; $counter > $loglevel; $counter --) {
- $logstars .= "=";
- }
- $logstars .= ">";
- }
-
- print STDERR ("$logstars ", @_, "\n");
- }
- }
-
-
-
- 1;
-
-