Query: log::any::adapter::development
OS: debian
Section: 3pm
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
Log::Any::Adapter::Development(3pm) User Contributed Perl Documentation Log::Any::Adapter::Development(3pm)NAMELog::Any::Adapter::Development -- Manual for developing new Log::Any adaptersVERSIONversion 0.07SYNOPSISThe adapter module: package Log::Any::Adapter::YAL; use strict; use warnings; use Log::Any::Adapter::Util qw(make_method); use base qw(Log::Any::Adapter::Base); # Optionally initialize object # sub init { my ($self) = @_; $self->{attr} = ...; } # Create logging methods: debug, info, etc. # foreach my $method ( Log::Any->logging_methods() ) { make_method($method, sub { ... }); } # Create detection methods: is_debug, is_info, etc. # foreach my $method ( Log::Any->detection_methods() ) { make_method($method, sub { ... }); } and the application: Log::Any->set_adapter('YAL');DESCRIPTIONThis document describes how to implement a new Log::Any adapter. The easiest way to start is to look at the source of existing adapters, such as Log::Any::Adapter::Log4perl and Log::Any::Adapter::Dispatch.NAMINGIf you are going to publicly release your adapter, call it 'Log::Any::Adapter::something' so that users can use it with Log::Any->set_adapter(I<something>); If it's an internal driver, you can call it whatever you like and use it like Log::Any->set_adapter('+My::Log::Adapter');BASE CLASSAll adapters must directly or indirectly inherit from Log::Any::Adapter::Base.METHODSConstructor The constructor ("new") is provided by Log::Any::Adapter::Base. It will: o place any adapter arguments into a hash, along with the category o bless the hash into your subclass o call "init" which may be optionally provided by your subclass At this point, overriding the default constructor is not supported. Hopefully it will not be needed. The constructor is called whenever a log object is requested. e.g. If the application initializes Log::Any like so: Log::Any->set_adapter('Log::YAL', yal_object => $yal, depth => 3); and then a class requests a logger like so: package Foo; use Log::Any qw($log); Then $log will be populated with the return value of: Log::Any::Adapter::Yal->new(yal_object => $yal, depth => 3, category => 'Foo'); This is memoized, so if the same category should be requested again (e.g. through a separate "get_logger" call, the same object will be returned. Therefore, you should try to avoid anything non-deterministic in your "init" function. Required methods The following methods have no default implementation, and MUST be defined by your subclass: debug ($msg) info ($msg) notice ($msg) warning ($msg) error ($msg) critical ($msg) alert ($msg) emergency ($msg) These methods log a message at the specified level. To help generate these methods programmatically, you can get a list of the method names with Log::Any->logging_methods is_debug () is_info () is_notice () is_warning () is_error () is_critical () is_alert () is_emergency () These methods return a boolean indicating whether the specified level is active. To help generate these methods programmatically, you can get a list of the method names with Log::Any->detection_methods Optional methods The following methods have no default implementation but MAY be provided by your subclass: init () This is called after the adapter object is created and blessed into your class. It will be a hash containing the parameters that were passed to new(). Perform any necessary validation or initialization here. Support methods The following methods are useful for defining adapters: delegate_method_to_slot ($slot, $method, $adapter_method) Handle the specified $method by calling $adapter_method on the object contained in $self->{$slot}. See Log::Any::Adapter::Dispatch and Log::Any::Adapter::Log4perl for examples of usage. Log::Any->logging_methods Returns a list of logging methods: debug, info, etc. Log::Any->detection_methods Returns a list of detection methods: is_debug, is_info, etc. Log::Any->logging_and_detection_methods Returns a combined list of logging and detection methods.SEE ALSOLog::AnyCOPYRIGHT AND LICENSEThis software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-02-22 Log::Any::Adapter::Development(3pm)
Related Man Pages |
---|
log::dispatch::output(3) - suse |
log::any(3pm) - debian |
log::dispatch::email(3pm) - debian |
log::handler::levels(3pm) - debian |
poet::log(3pm) - debian |
Similar Topics in the Unix Linux Community |
---|
FCS1 Error in AIX |
mix fc and tape devices |
20EE0008 : No adapters found Adapter, Riser, System Bd. |
Command to get Disk Adapter details in AIX |
Dedicate graphics adapter ? |