1 # This file was automatically generated by SWIG (http://www.swig.org).
4 # Don't modify this file, modify the SWIG interface instead.
9 @ISA = qw(Exporter DynaLoader);
10 package Amanda::Debugc;
11 bootstrap Amanda::Debug;
12 package Amanda::Debug;
15 # ---------- BASE METHODS -------------
17 package Amanda::Debug;
20 my ($classname,$obj) = @_;
21 return bless $obj, $classname;
31 my ($self,$field) = @_;
32 my $member_func = "swig_${field}_get";
33 $self->$member_func();
37 my ($self,$field,$newval) = @_;
38 my $member_func = "swig_${field}_set";
39 $self->$member_func($newval);
48 # ------- FUNCTION WRAPPERS --------
50 package Amanda::Debug;
52 *dbopen = *Amanda::Debugc::dbopen;
53 *dbreopen = *Amanda::Debugc::dbreopen;
54 *dbrename = *Amanda::Debugc::dbrename;
55 *dbclose = *Amanda::Debugc::dbclose;
56 *error = *Amanda::Debugc::error;
57 *critical = *Amanda::Debugc::critical;
58 *warning = *Amanda::Debugc::warning;
59 *message = *Amanda::Debugc::message;
60 *info = *Amanda::Debugc::info;
61 *debug = *Amanda::Debugc::debug;
62 *dbfd = *Amanda::Debugc::dbfd;
63 *dbfn = *Amanda::Debugc::dbfn;
64 *debug_dup_stderr_to_debug = *Amanda::Debugc::debug_dup_stderr_to_debug;
66 # ------- VARIABLE STUBS --------
68 package Amanda::Debug;
70 *ERR_INTERACTIVE = *Amanda::Debugc::ERR_INTERACTIVE;
71 *ERR_SYSLOG = *Amanda::Debugc::ERR_SYSLOG;
72 *ERR_AMANDALOG = *Amanda::Debugc::ERR_AMANDALOG;
73 *erroutput_type = *Amanda::Debugc::erroutput_type;
74 *error_exit_status = *Amanda::Debugc::error_exit_status;
81 Amanda::Debug - support for debugging Amanda applications
85 use Amanda::Debug qw( :init :logging );
87 # (note: dbopen and such are usually handled by
88 # Amanda::Util::setup_applicaton)
91 debug("this is a debug message");
93 See C<debug.h> for a more in-depth description of the functionality of
102 Several debug logging messages, each taking a single string, are
107 =item C<error> - also aborts the program to produce a core dump
109 =item C<critical> - exits the program with C<$error_exit_status>
121 ALl of the debug logging functions are available via the export tag
124 =head1 ADVANCED USAGE
126 Most applications should use L<Amanda::Util>'s C<setup_application>
127 to initialize the debug libraries. The initialization functions
128 available from this module are thus considered "advanced", and the
129 reader is advised to consult the C header, C<debug.h>, for details.
131 Briefly, the functions C<dbopen> and C<dbrename> are used to
132 open a debug file whose pathname includes all of the relevant
133 information. C<dbclose> and C<dbreopen> are used to close that debug
134 file before transferring control to another process.
136 The variable C<$erroutput_type> can take on any combination
137 of the flags C<$ERROUTPUT_INTERACTIVE>, C<$ERROUTPUT_SYSLOG>
138 and C<$ERROUTPUT_AMANDALOG>. C<$ERROUTPUT_INTERACTIVE>
139 causes messages from C<error> and C<critical> to be sent
140 to stderr. C<$ERROUTPUT_SYSLOG> sends it to syslog, and
141 C<$ERROUTPUT_AMANDALOG> sends it to the current trace log (see
144 C<$error_exit_status> is the exit status with which C<critical>
147 All of the initialization functions and variables are available via
148 the export tag C<:init>.
150 The current debug file's integer file descriptor (I<not> a Perl
151 filehandle) is available from C<dbfd()>. Likewise, C<dbfn()> returns
152 the filename of the current debug file.
154 C<debug_dup_stderr_to_debug()> redirects, at the file-descriptor level,
155 C<STDERR> into the debug file. This is useful when running external
156 applications which may produce error output.
160 push @EXPORT_OK, qw(dbopen dbreopen dbrename dbclose
161 $erroutput_type $error_exit_status);
162 push @{$EXPORT_TAGS{"init"}}, qw(dbopen dbreopen dbrename dbclose
163 $erroutput_type $error_exit_status);
165 push @EXPORT_OK, qw(erroutput_type_t_to_strings);
166 push @{$EXPORT_TAGS{"erroutput_type_t"}}, qw(erroutput_type_t_to_strings);
168 my %_erroutput_type_t_VALUES;
169 #Convert a flag value to a list of names for flags that are set.
170 sub erroutput_type_t_to_strings {
174 for my $k (keys %_erroutput_type_t_VALUES) {
175 my $v = $_erroutput_type_t_VALUES{$k};
177 #is this a matching flag?
178 if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
183 #by default, just return the number as a 1-element list
191 push @EXPORT_OK, qw($ERR_INTERACTIVE);
192 push @{$EXPORT_TAGS{"erroutput_type_t"}}, qw($ERR_INTERACTIVE);
194 $_erroutput_type_t_VALUES{"INTERACTIVE"} = $ERR_INTERACTIVE;
196 push @EXPORT_OK, qw($ERR_SYSLOG);
197 push @{$EXPORT_TAGS{"erroutput_type_t"}}, qw($ERR_SYSLOG);
199 $_erroutput_type_t_VALUES{"SYSLOG"} = $ERR_SYSLOG;
201 push @EXPORT_OK, qw($ERR_AMANDALOG);
202 push @{$EXPORT_TAGS{"erroutput_type_t"}}, qw($ERR_AMANDALOG);
204 $_erroutput_type_t_VALUES{"AMANDALOG"} = $ERR_AMANDALOG;
206 push @EXPORT_OK, qw(error critical warning message info debug);
207 push @{$EXPORT_TAGS{"logging"}}, qw(error critical warning message info debug);