NAME Log::Any::For::Class - Add logging to class VERSION version 0.16 SYNOPSIS use Log::Any::For::Class qw(add_logging_to_class); add_logging_to_class(classes => [qw/My::Class My::SubClass/]); # now method calls to your classes are logged, by default at level 'trace' CREDITS Some code portion taken from Devel::TraceMethods. SEE ALSO Log::Any::For::Package Log::Any::For::DBI, an application of this module. DESCRIPTION This module has Rinci metadata. FUNCTIONS None are exported by default, but they are exportable. add_logging_to_class(%args) -> any Add logging to class. Logging will be done using Log::Any. Currently this function adds logging around method calls, e.g.: -> Class::method(...) <- Class::method() = RESULT ... Arguments ('*' denotes required arguments): * classes* => *array* Classes to add logging to. * filter_methods => *array* Filter methods to add logging to. The default is to add logging to all non-private methods. Private methods are those prefixed by "_". * logger_args => *any* Pass arguments to logger. This allows passing arguments to logger routine (see "logger_args"). * postcall_logger => *code* Supply custom postcall logger. Just like precall*logger, but code will be called after method is call. Code will be given a hashref argument \%args containing these keys: "args" (arrayref, a shallow copy of the original @*), "orig" (coderef, the original method), "name" (string, a shallow copy of the fully-qualified method name), "result" (arrayref, the method result), "logger_args" (arguments given when adding logging). You can use this mechanism to customize logging. * precall_logger => *code* Supply custom precall logger. Code will be called when logging method call. Code will be given a hashref argument \%args containing these keys: "args" (arrayref, a shallow copy of the original @_), "orig" (coderef, the original method), "name" (string, the fully-qualified method name), "logger_args" (arguments given when adding logging). You can use this mechanism to customize logging. The default logger accepts this arguments (in "logger_args"): * indent => INT (default: 0) Indent according to nesting level. * max_depth => INT (default: -1) Only log to this nesting level. -1 means unlimited. Return value: AUTHOR Steven Haryanto COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Steven Haryanto. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.