Changed debug to not use constants.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1704 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2005-12-20 17:03:33 +00:00
parent ff94ac0a8e
commit 948528bb44
16 changed files with 31 additions and 35 deletions

View File

@ -47,6 +47,7 @@ our %EXPORT_TAGS = ( 'all' => [ qw(
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw( our @EXPORT = qw(
zmDbgInit
Debug Debug
Info Info
Warning Warning
@ -82,20 +83,13 @@ sub zmDbgInit
{ {
$dbg_id = $id; $dbg_id = $id;
} }
else
{
$dbg_id = main::DBG_ID;
}
if ( defined($level) ) if ( defined($level) )
{ {
$dbg_level = $level; $dbg_level = $level;
} }
else
{
$dbg_level = main::DBG_LEVEL;
}
openlog( $dbg_id, "pid,ndelay", "local1" ); openlog( $dbg_id, "pid,ndelay", "local1" );
$dbg_initialised = !undef; $dbg_initialised = !undef;
} }

View File

@ -83,32 +83,6 @@ Parameters are :-
exit( -1 ); exit( -1 );
} }
my $dbg_id = "";
sub dbgInit
{
my $id = shift;
if ( $id )
{
$dbg_id = $id;
my $add_parms = shift;
if ( $add_parms )
{
foreach my $arg ( @ARGV )
{
if ( $arg =~ /^-(.*)$/ )
{
$dbg_id .= "_$1";
}
else
{
$dbg_id .= $arg;
}
}
}
}
}
sub aud_print sub aud_print
{ {
my $string = shift; my $string = shift;
@ -169,7 +143,7 @@ sub confirm
return( $yesno ); return( $yesno );
} }
dbgInit( "zmaudit", 1 ); zmDbgInit( DBG_ID, DBG_LEVEL );
if ( !GetOptions( 'report'=>\$report, 'yes'=>\$yes, 'delay=i'=>\$delay ) ) if ( !GetOptions( 'report'=>\$report, 'yes'=>\$yes, 'delay=i'=>\$delay ) )
{ {

View File

@ -58,6 +58,8 @@ Usage: zmcontrol-axis-v2.pl <various options>
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $arg_string = join( " ", @ARGV ); my $arg_string = join( " ", @ARGV );
my $address; my $address;

View File

@ -58,6 +58,8 @@ Usage: zmcontrol-kx-hcm10.pl <various options>
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $arg_string = join( " ", @ARGV ); my $arg_string = join( " ", @ARGV );
my $address; my $address;

View File

@ -59,6 +59,8 @@ Usage: zmcontrol-pelco-d.pl <various options>
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $arg_string = join( " ", @ARGV ); my $arg_string = join( " ", @ARGV );
my $device = "/dev/ttyS0"; my $device = "/dev/ttyS0";

View File

@ -60,6 +60,8 @@ Usage: zmcontrol-pelco-d.pl <various options>
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $arg_string = join( " ", @ARGV ); my $arg_string = join( " ", @ARGV );
my $device = "/dev/ttyS0"; my $device = "/dev/ttyS0";

View File

@ -58,6 +58,8 @@ Usage: zmcontrol-visca.pl <various options>
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $arg_string = join( " ", @ARGV ); my $arg_string = join( " ", @ARGV );
my $device = "/dev/ttyS0"; my $device = "/dev/ttyS0";

View File

@ -62,6 +62,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
my @daemons = ( 'zmc', 'zma', 'zmf', 'zmfilter.pl', 'zmaudit.pl', 'zmtrigger.pl', 'zmx10.pl', 'zmwatch.pl', 'zmupdate.pl', 'zmtrack.pl' ); my @daemons = ( 'zmc', 'zma', 'zmf', 'zmfilter.pl', 'zmaudit.pl', 'zmtrigger.pl', 'zmx10.pl', 'zmwatch.pl', 'zmupdate.pl', 'zmtrack.pl' );
my $command = shift @ARGV; my $command = shift @ARGV;

View File

@ -56,6 +56,8 @@ use Getopt::Long;
use constant EVENT_PATH => ZM_PATH_WEB.'/'.ZM_DIR_EVENTS; use constant EVENT_PATH => ZM_PATH_WEB.'/'.ZM_DIR_EVENTS;
use constant LOG_FILE => ZM_PATH_LOGS.'/zmfilter.log'; use constant LOG_FILE => ZM_PATH_LOGS.'/zmfilter.log';
zmDbgInit( DBG_ID, DBG_LEVEL );
if ( ZM_OPT_UPLOAD ) if ( ZM_OPT_UPLOAD )
{ {
# Comment these out if you don't have them and don't want to upload # Comment these out if you don't have them and don't want to upload

View File

@ -54,6 +54,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
my $command = $ARGV[0]; my $command = $ARGV[0];
my $state; my $state;

View File

@ -76,6 +76,8 @@ if ( !GetOptions( 'monitor=s'=>\$mid ) )
Usage(); Usage();
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my ( $detaint_mid ) = $mid =~ /^(\d+)$/; my ( $detaint_mid ) = $mid =~ /^(\d+)$/;
$mid = $detaint_mid; $mid = $detaint_mid;

View File

@ -74,6 +74,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
open( LOG, ">>".LOG_FILE ) or die( "Can't open log file: $!" ); open( LOG, ">>".LOG_FILE ) or die( "Can't open log file: $!" );
open(STDOUT, ">&LOG") || die( "Can't dup stdout: $!" ); open(STDOUT, ">&LOG") || die( "Can't dup stdout: $!" );
select( STDOUT ); $| = 1; select( STDOUT ); $| = 1;

View File

@ -60,6 +60,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
my $check = 0; my $check = 0;
my $rename = 0; my $rename = 0;
my $zone_fix = 0; my $zone_fix = 0;

View File

@ -55,6 +55,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
my $event_id; my $event_id;
my $format = 'mpg'; my $format = 'mpg';
my $rate = ''; my $rate = '';

View File

@ -66,6 +66,8 @@ Usage: zmwatch.pl
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
open( LOG, '>>'.WATCH_LOG_FILE ) or die( "Can't open log file: $!" ); open( LOG, '>>'.WATCH_LOG_FILE ) or die( "Can't open log file: $!" );
open( STDOUT, ">&LOG" ) || die( "Can't dup stdout: $!" ); open( STDOUT, ">&LOG" ) || die( "Can't dup stdout: $!" );
select( STDOUT ); $| = 1; select( STDOUT ); $| = 1;

View File

@ -68,6 +68,8 @@ Parameters are :-
exit( -1 ); exit( -1 );
} }
zmDbgInit( DBG_ID, DBG_LEVEL );
my $command; my $command;
my $unit_code; my $unit_code;