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 = qw(
zmDbgInit
Debug
Info
Warning
@ -82,20 +83,13 @@ sub zmDbgInit
{
$dbg_id = $id;
}
else
{
$dbg_id = main::DBG_ID;
}
if ( defined($level) )
{
$dbg_level = $level;
}
else
{
$dbg_level = main::DBG_LEVEL;
}
openlog( $dbg_id, "pid,ndelay", "local1" );
$dbg_initialised = !undef;
}

View File

@ -83,32 +83,6 @@ Parameters are :-
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
{
my $string = shift;
@ -169,7 +143,7 @@ sub confirm
return( $yesno );
}
dbgInit( "zmaudit", 1 );
zmDbgInit( DBG_ID, DBG_LEVEL );
if ( !GetOptions( 'report'=>\$report, 'yes'=>\$yes, 'delay=i'=>\$delay ) )
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,6 +62,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
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 $command = shift @ARGV;

View File

@ -56,6 +56,8 @@ use Getopt::Long;
use constant EVENT_PATH => ZM_PATH_WEB.'/'.ZM_DIR_EVENTS;
use constant LOG_FILE => ZM_PATH_LOGS.'/zmfilter.log';
zmDbgInit( DBG_ID, DBG_LEVEL );
if ( ZM_OPT_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};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
zmDbgInit( DBG_ID, DBG_LEVEL );
my $command = $ARGV[0];
my $state;

View File

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

View File

@ -74,6 +74,8 @@ $ENV{PATH} = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
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(STDOUT, ">&LOG") || die( "Can't dup stdout: $!" );
select( STDOUT ); $| = 1;

View File

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

View File

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

View File

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

View File

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