| Log-Agent documentation | Contained in the Log-Agent distribution. |
Log::Agent::Tag::String - a constant tag string
require Log::Agent::Tag::String;
# Inherits from Log::Agent::Tag.
my $tag = Log::Agent::Tag::String->make(
-name => "session id",
-value => $session,
-postfix => 1,
-separator => " -- ",
);
This class represents a constant tag string.
The following parameters are defined, in alphabetical order:
-name => nameThe name of this tag. Currently unused.
-postfix => flagWhether tag should be placed after or before the log message. By default, it is prepended to the log message, i.e. this parameter is false.
-separator => stringThe separation string between the tag and the log message. A single space by default.
-value => stringThe tag's value.
Raphael Manfredi <Raphael_Manfredi@pobox.com>
Log::Agent::Tag(3), Log::Agent::Message(3).
| Log-Agent documentation | Contained in the Log-Agent distribution. |
# # $Id: String.pm,v 1.1 2002/03/09 16:10:33 wendigo Exp $ # # Copyright (c) 1999, Raphael Manfredi # # You may redistribute only under the terms of the Artistic License, # as specified in the README file that comes with the distribution. # # HISTORY # $Log: String.pm,v $ # Revision 1.1 2002/03/09 16:10:33 wendigo # New maintainer # # Revision 0.2.1.2 2001/03/31 10:02:25 ram # patch7: fixed =over to add explicit indent level # # Revision 0.2.1.1 2001/03/13 18:45:21 ram # patch2: created # # Revision 0.2 2000/11/06 19:30:32 ram # Baseline for second Alpha release. # # $EndLog$ # use strict; ######################################################################## package Log::Agent::Tag::String; require Log::Agent::Tag; use vars qw(@ISA); @ISA = qw(Log::Agent::Tag); # # ->make # # Creation routine. # # Calling arguments: a hash table list. # # The keyed argument list may contain: # -POSTFIX whether to postfix log message or prefix it. # -SEPARATOR separator string to use between tag and message # -NAME tag's name (optional) # -VALUE string value to use # # Attributes: # string the string value # sub make { my $self = bless {}, shift; my (%args) = @_; my ($name, $postfix, $separator, $value); my %set = ( -name => \$name, -value => \$value, -postfix => \$postfix, -separator => \$separator, ); while (my ($arg, $val) = each %args) { my $vset = $set{lc($arg)}; next unless ref $vset; $$vset = $val; } $self->_init($name, $postfix, $separator); $self->{string} = $value; return $self; } # # Defined routines # sub string { $_[0]->{'string'} } 1; # for "require" __END__