Log::Dispatch::ToTk - Class to redirect Log::Dispatch to Tk widgets


Log-Dispatch-Tk documentation  | view source Contained in the Log-Dispatch-Tk distribution.

Index


NAME

Top

Log::Dispatch::ToTk - Class to redirect Log::Dispatch to Tk widgets

SYNOPSIS

Top

 # Log::Dispatch::ToTk must be used in a composite widget

 Tk::Widget->Construct('LogText');

 sub InitObject
  {
    my ($dw,$args) = @_ ;

    # retrieve parameters specific to Log::Dispatch::*
    my %params ;
    foreach my $key (qw/name min_level max_level/)
      {
        $params{$key} = delete $args->{$key} 
           if defined $args->{$key};
      } 

    # create the TkTk buddy class
    $dw->{logger} = Log::Dispatch::ToTk->
      new(%params, widget => $dw) ;

    # initiaze the widget
    $dw->SUPER::InitObject($args) ;
  }

 # mandatory method in Tk widget using Log::Dispatch::ToTk
 sub logger
  {
    my $dw = shift;
    return $dw->{logger} ;
  }




__END__

DESCRIPTION

Top

Most users will only need to use Log::Dispatch::TkText widget to have Log::Dispatch messages written on a text widget.

For more fancy uses, this module can be used by a composite widget dedicated to handle Log::Dispatch logs.

This module is the interface class between Log::Dispatch and Tk widgets. This class is derived from Log::Dispatch::Output.

One ToTk object will be created for each Log::Dispatch::Tk* widget and the user must register the ToTk object to the log dispatcher.

METHODS

Top

new(...)

Create a new ToTk object. Parameter are :

* widget ($)

The buddy widget object

* name ($)

The name of the object (not the filename!). Required.

* min_level ($)

The minimum logging level this object will accept. See the Log::Dispatch documentation for more information. Required.

* max_level ($)

The maximum logging level this obejct will accept. See the Log::Dispatch documentation for more information. This is not required. By default the maximum is the highest possible level (which means functionally that the object has no maximum).

log_message( level => $, message => $ )

Sends a message if the level is greater than or equal to the object's minimum level.

AUTHOR

Top

Dominique Dumont <Dominique.Dumont@hp.com> using Log::Dispatch and Log::Dispatch::Output from Dave Rolsky, autarch@urth.org

Copyright (c) 2000, 2003 Hewlett-Packard Company. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Top

Log::Dispatch, Log::Dispatch::Email, Log::Dispatch::Email::MailSend, Log::Dispatch::Email::MailSendmail, Log::Dispatch::Email::MIMELite, Log::Dispatch::File, Log::Dispatch::Handle, Log::Dispatch::Screen, Log::Dispatch::Syslog, Log::Dispatch::TkText


Log-Dispatch-Tk documentation  | view source Contained in the Log-Dispatch-Tk distribution.