---
name: "Log::Any::Adapter::Util"
section: "3pm"
platform: "linux"
package: "liblog-any-perl"
version: "1.717-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Log::Any::Adapter::Util"
---

# Log::Any::Adapter::Util(3pm)

Common utility functions for Log::Any

## NAME

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

## VERSION

version 1.717

## 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.

## SUBROUTINES

### logging\_methods

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

### detection\_methods

Returns a list of detection methods.  E.g. "is\_trace", "is\_info", etc.

### logging\_and\_detection\_methods

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

### log\_level\_aliases

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

### logging\_aliases

Returns a list of logging alias names.  These are the keys from "log\_level\_aliases".

### detection\_aliases

Returns a list of detection aliases.  E.g. "is\_err", "is\_fatal", etc.

### numeric\_level

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

### 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.

### require\_dynamic (DEPRECATED)

Given a class name, attempts to load it via require unless the class already has a constructor available.  Throws an error on failure. Used internally and may become private in the future.

### read\_file (DEPRECATED)

Slurp a file.  Does \*not\* apply any layers.  Used for testing and may become private in the future.

### cmp\_deeply (DEPRECATED)

Compares dump\_one\_line results for two references.  Also takes a test label as a third argument.  Used for testing and may become private in the future.

## 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
```

## AUTHORS

- •

  Jonathan Swartz \<swartz@pobox.com\>

- •

  David Golden \<dagolden@cpan.org\>

- •

  Doug Bell \<preaction@cpan.org\>

- •

  Daniel Pittman \<daniel@rimspace.net\>

- •

  Stephen Thirlwall \<sdt@cpan.org\>

## COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jonathan Swartz, David Golden, and Doug Bell.

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