NAME

Log::Any::Adapter::Util - Common utility functions for Log::Any

VERSION

version 0.91

DESCRIPTION

This module has utility functions to help develop Log::Any::Adapter subclasses or Log::Any::Proxy formatters/filters. It also has some functions used in internal testing.

USAGE

Nothing is exported by default.

Log level constants

If the :levels tag is included in the import list, the following numeric constants will be imported:

EMERGENCY => 0
ALERT     => 1
CRITICAL  => 2
ERROR     => 3
WARNING   => 4
NOTICE    => 5
INFO      => 6
DEBUG     => 7
TRACE     => 8

FUNCTIONS

log_level_aliases

Returns key/value pairs mapping aliases to "official" names. E.g. "err" maps to "error".

logging_methods

Returns a list of all logging method. E.g. "trace", "info", etc.

logging_aliases

Returns a list of logging alias names. These are the keys from "log_level_aliases".

detection_methods

Returns a list of detection methods. E.g. "is_trace", "is_info", etc.

detection_aliases

Returns a list of detection aliases. E.g. "is_err", "is_fatal", etc.

logging_and_detection_methods

Returns a list of logging and detection methods (but not aliases).

cmp_deeply

Used for testing; compares one-line Data::Dumper dumps for two references. Also takes a test label as a third argument.

dump_one_line

Given a reference, returns a one-line Data::Dumper dump with keys sorted.

make_method

Given a method name, a code reference and a package name, installs the code reference as a method in the package.

read_file

Slurp a file. Does *not* apply any layers.

require_dynamic

Given a class name, attempts to load it via require. Throws an error on failure.

numeric_level

Given a level name (or alias), returns the numeric value described above under log level constants. E.g. "err" would return 3.

AUTHORS

  • Jonathan Swartz <swartz@pobox.com>

  • David Golden <dagolden@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Jonathan Swartz and David Golden.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.