ZOOM::IRSpy::Web - subclass of ZOOM::IRSpy for use by Web UI


ZOOM-IRSpy documentation Contained in the ZOOM-IRSpy distribution.

Index


Code Index:

NAME

Top

ZOOM::IRSpy::Web - subclass of ZOOM::IRSpy for use by Web UI

DESCRIPTION

Top

This behaves exactly the same as the base ZOOM::IRSpy class except that the Clog()> method does not call YAZ log, but outputs HTML-formatted messages on standard output. The additional function log_init_level() controls what log-levels are to be included in the output. Note that this arrangement only allows IRSpy-specific logging to be generated, not underlying ZOOM logging.

SEE ALSO

Top

ZOOM::IRSpy

AUTHOR

Top

Mike Taylor, <mike@indexdata.com>

COPYRIGHT AND LICENSE

Top


ZOOM-IRSpy documentation Contained in the ZOOM-IRSpy distribution.
package ZOOM::IRSpy::Web;

use 5.008;
use strict;
use warnings;

use ZOOM::IRSpy;
our @ISA = qw(ZOOM::IRSpy);

use ZOOM::IRSpy::Utils qw(xml_encode);


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) = @_;

    $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";

    ### This is naughty -- it knows about HTML::Mason
    $HTML::Mason::Commands::m->flush_buffer();
}


1;