projects
/
irspy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removing dublicated code.
[irspy-moved-to-github.git]
/
lib
/
ZOOM
/
IRSpy
/
Web.pm
diff --git
a/lib/ZOOM/IRSpy/Web.pm
b/lib/ZOOM/IRSpy/Web.pm
index
9ec823c
..
d347b45
100644
(file)
--- a/
lib/ZOOM/IRSpy/Web.pm
+++ b/
lib/ZOOM/IRSpy/Web.pm
@@
-1,4
+1,4
@@
-# $Id: Web.pm,v 1.1 2006-09-26 09:31:10 mike Exp $
+# $Id: Web.pm,v 1.3 2006-10-20 14:51:41 mike Exp $
package ZOOM::IRSpy::Web;
package ZOOM::IRSpy::Web;
@@
-6,10
+6,9
@@
use 5.008;
use strict;
use warnings;
use strict;
use warnings;
-use ZOOM::IRSpy;
+use ZOOM::IRSpy qw(xml_encode);
our @ISA = qw(ZOOM::IRSpy);
our @ISA = qw(ZOOM::IRSpy);
-use ZOOM::IRSpy::Record qw(xml_encode);
=head1 NAME
=head1 NAME
@@
-19,18
+18,34
@@
ZOOM::IRSpy::Web - subclass of ZOOM::IRSpy for use by Web UI
This behaves exactly the same as the base C<ZOOM::IRSpy> class except
that the Clog()> method does not call YAZ log, but outputs
This behaves exactly the same as the base C<ZOOM::IRSpy> class except
that the Clog()> method does not call YAZ log, but outputs
-HTML-formatted messages on standard output.
+HTML-formatted messages on standard output. The additional function
+log_init_level() controls what log-levels are to be included in the
+output.
=cut
=cut
+sub log_init_level {
+ my $this = shift();
+ my($level) = @_;
+
+ my $old = $this->{log_level};
+ $this->{log_level} = $level if defined $level;
+ return $old;
+}
+
sub log {
my $this = shift();
my($level, @s) = @_;
sub log {
my $this = shift();
my($level, @s) = @_;
- # We should only produce output if $level is turned on
+ $this->{log_level} = "irspy" if !defined $this->{log_level};
+ return if index(("," . $this->{log_level} . ","), ",$level,") < 0;
+
my $message = "[$level] " . join("", @s);
$| = 1; #
print xml_encode($message), "<br/>\n";
my $message = "[$level] " . join("", @s);
$| = 1; #
print xml_encode($message), "<br/>\n";
+
+ ### This is naughty -- it knows about HTML::Mason
+ $HTML::Mason::Commands::m->flush_buffer();
}
}