Amanda::Debug - support for debugging Amanda applications
use Amanda::Util qw( :constants );
Amanda::Util::setup_application("amcooltool", "server", $CONTEXT_CMDLINE);
debug("this is a debug message");
die("Unable to frobnicate the ergonator");
See debug.h
for a more in-depth description of the logging functionality of this module.
Several debug logging functions, each taking a single string, are available:
error
- also aborts the program to produce a core dumpcritical
- exits the program with $error_exit_status
warning
message
info
debug
Perl's built-in die
and warn
functions are patched to call critical
and warning
, respectively.
All of the debug logging functions are available via the export tag :logging
.
Applications can adjust the handling of log messages with add_amanda_log_handler($hdlr)
where $hdlr
is a predefined log destination. The following destinations are available in this package. See Amanda::Logfile for $amanda_log_trace_log
.
$amanda_log_null
$amanda_log_stderr
$amanda_log_syslog
Most applications should use Amanda::Util's setup_application
to initialize the debug libraries. The initialization functions available from this module are thus considered "advanced", and the reader is advised to consult the C header, debug.h
, for details.
Briefly, the functions dbopen
and dbrename
are used to open a debug file whose pathname includes all of the relevant information. dbclose
and dbreopen
are used to close that debug file before transferring control to another process.
$error_exit_status
is the exit status with which critical
will exit.
All of the initialization functions and variables are available via the export tag :init
.
The current debug file's integer file descriptor (not a Perl filehandle) is available from dbfd()
. Likewise, dbfn()
returns the filename of the current debug file.
debug_dup_stderr_to_debug()
redirects, at the file-descriptor level, STDERR
into the debug file. This is useful when running external applications which may produce error output.
This page was automatically generated Tue Mar 19 07:08:15 2019 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.