File: Log.pm

package info (click to toggle)
haci 0.98c-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,240 kB
  • sloc: perl: 23,790; javascript: 1,817; sh: 225; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package HaCi::Log;

use warnings;
use strict;

require Exporter;
our @ISA				= qw(Exporter);
our @EXPORT_OK	= qw(warnl debug);

our $conf; *conf  = \$HaCi::Conf::conf;

sub warnl {
	warn 'SUB: ' . (caller(0))[3] . ' (' . (caller(1))[3] . ")\n" if $conf->{var}->{showsubs};
	my $error	= shift;
	my $bNPub	= shift || 0;
	my ($caller, $line)	= (caller)[0, 2];
	
	warn "$caller:$line $error\n";

	push @{$conf->{var}->{warnl}}, $error unless $bNPub;
}

sub debug {
	warn 'SUB: ' . (caller(0))[3] . ' (' . (caller(1))[3] . ")\n" if $conf->{var}->{showsubs};
	my $msg = shift;

	chomp($msg);
	$msg	.= "\n";
	  
	warn $msg if $conf->{static}->{misc}->{debug};
}

# vim:ts=2:sw=2:sws=2