Log::Message::Handlers(3) User Contributed Perl Documentation Log::Message::Handlers(3)

# [NAME](#NAME)

Log::Message::Handlers - Message handlers for Log::Message

# [SYNOPSIS](#SYNOPSIS)

```
    # Implicitly used by Log::Message to serve as handlers for
    # Log::Message::Item objects
    # Create your own file with a package called
    # Log::Message::Handlers to add to the existing ones, or to even
    # overwrite them
    $item->carp;
    $item->trace;
```

# [DESCRIPTION](#DESCRIPTION)

Log::Message::Handlers provides handlers for Log::Message::Item objects. The handler corresponding to the level (see Log::Message::Item manpage for an explanation about levels) will be called automatically upon storing the error.

Handlers may also explicitly be called on an Log::Message::Item object if one so desires (see the Log::Message manpage on how to retrieve the Item objects).

# [Default Handlers](#Default_Handlers)

## [log](#log)

Will simply log the error on the stack, and do nothing special

## [carp](#carp)

Will carp (see the Carp manpage) with the error, and add the timestamp of when it occurred.

## [croak](#croak)

Will croak (see the Carp manpage) with the error, and add the timestamp of when it occurred.

## [cluck](#cluck)

Will cluck (see the Carp manpage) with the error, and add the timestamp of when it occurred.

## [confess](#confess)

Will confess (see the Carp manpage) with the error, and add the timestamp of when it occurred

## [die](#die)

Will simply die with the error message of the item

## [warn](#warn)

Will simply warn with the error message of the item

## [trace](#trace)

Will provide a traceback of this error item back to the first one that occurred, clucking with every item as it comes across it.

# [Custom Handlers](#Custom_Handlers)

If you wish to provide your own handlers, you can simply do the following:

- Create a file that holds a package by the name of "Log::Message::Handlers"
- Create subroutines with the same name as the levels you wish to handle in the Log::Message module (see the Log::Message manpage for explanation on levels)
- Require that file in your program, or add it in your configuration (see the Log::Message::Config manpage for explanation on how to use a config file)

And that is it, the handler will now be available to handle messages for you.

The arguments a handler may receive are those specified by the "extra" key, when storing the message. See the Log::Message manpage for details on the arguments.

# [SEE ALSO](#SEE_ALSO)

Log::Message, Log::Message::Item, Log::Message::Config

# [AUTHOR](#AUTHOR)

This module by Jos Boumans &lt;kane@cpan.org&gt;.

# [Acknowledgements](#Acknowledgements)

Thanks to Ann Barcomb for her suggestions.

# [COPYRIGHT](#COPYRIGHT)

This module is copyright (c) 2002 Jos Boumans &lt;kane@cpan.org&gt;. All rights reserved.

This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.

2026-08-17 perl v5.44.0

---

Document: Log::Message::Handlers(3pm) from perl-log-message 0.08-r1 (Chainguard OS)
Source: https://github.com/jib/log-message
