The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
                           Log::Agent 0.2
               Copyright (c) 1999-2000, Raphael Manfredi

------------------------------------------------------------------------
    This program is free software; you can redistribute it and/or modify
    it under the terms of the Artistic License, a copy of which can be
    found with perl.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Artistic License for more details.
------------------------------------------------------------------------

       *** This is alpha software -- use at your own risks ***

Name           DSLI  Description                                  Info
-----------    ----  -------------------------------------------- -----
Log::Agent     adpO  A general logging framework                  RAM

SYNOPSIS

	#
	# In reusable modules, log via logxxx() routines
	#

	use Log::Agent;

	logsay "creating file";
	open(FILE, ">>file") || logdie "can't append to file: $!";
	....
	close FILE;
	logwarn "MANIFEST not found" unless -e 'MANIFEST';

	#
	# In the application, choose a driver for logxxx() messages
	#
	# Default behaviour: no need to do anything. logxxx() messages will
	# be mapped to print, warn or die, as appropriate.
	#
	# Or customize a driver, as we do here.
	#

	use Log::Agent;
	require Log::Agent::Driver::File;

	(my $me = $0) =~ s|.*/(.*)|$1|;

	my $driver = Log::Agent::Driver::File->make(
		-prefix     => $me,
		-showpid    => 1,
		-channels   => {
			'error'    => '/tmp/output.err',
			'output'   => 'log.out',
			'debug'    => '../appli.debug',
		},
	);
	logconfig(-driver => $driver, -level => 'notice');

	#
	# Alternative: redirect to syslog
	#

	use Log::Agent;
	require Log::Agent::Driver::Syslog;

	(my $me = $0) =~ s|.*/(.*)|$1|;

	my $driver = Log::Agent::Driver::Syslog->make(
		-prefix     => $me,
		-showpid    => 1,
		-facility   => "user",
		-logopt     => "ndelay",
	);
	logconfig(-driver => $driver, -level => 'debug');

DESCRIPTION

Log::Agent is a general logging framework aimed at reusable modules.

Instead of having modules insist on using their onw logging reporting
(by hardwiring calls to warn() or syslog()) which can conflict with
the final application's choice, one may use logwarn() for instance to
emit a warning.

It is then up to the application to decide, once and for all, which
logging scheme should be used, by selecting a proper driver. If it
does not select one, the Default driver will be used, which is a simple
mapping of the logwarn() routine to warn(), for instance.

Or the application may choose to use the Silent driver to make all the
logwarn() calls be ignored, the Syslog driver to redirect logwarn()
to Sys::Syslog, or the File driver to redirect logwarn() to the 'error'
channel defined (by default STDERR), whith proper time stamping.

The available calls are:

	logdie
	logerr
	logwarn
	logsay
	logtrc 'priority', "message"
	logdbg 'priority', "message"

Please read the Log::Agent(3) manpage and the related pages for more
information.

-- Raphael Manfredi <Raphael_Manfredi@pobox.com>