NAME

Dancer2::Plugin::LogReport::Message - extended Log::Report::Message class

INHERITANCE

Dancer2::Plugin::LogReport::Message
  is a Log::Report::Message

SYNOPSIS

In your template:

[% FOR message IN messages %]
  <div class="alert alert-[% message.bootstrapColor %]">
    [% message.toString | html_entity %]
  </div>
[% END %]

DESCRIPTION

[This Dancer2 plugin was contributed by Andrew Beverley]

This class is an extension of Log::Report::Message, with functions specifically designed for Dancer applications. Minimal functions are provided (currently only aimed at Bootstrap), but ideas for new ones are welcome.

Extends "DESCRIPTION" in Log::Report::Message.

OVERLOADED

Extends "OVERLOADED" in Log::Report::Message.

overload: '""' stringification

Inherited, see "OVERLOADED" in Log::Report::Message

overload: '&{}' used as function

Inherited, see "OVERLOADED" in Log::Report::Message

overload: '.' concatenation

Inherited, see "OVERLOADED" in Log::Report::Message

METHODS

Extends "METHODS" in Log::Report::Message.

Constructors

Extends "Constructors" in Log::Report::Message.

$obj->clone(%options, $variables)

Inherited, see "Constructors" in Log::Report::Message

$class->new(%options)

Inherited, see "Constructors" in Log::Report::Message

-Option   --Defined in          --Default
 _append    Log::Report::Message  undef
 _category  Log::Report::Message  undef
 _class     Log::Report::Message  undef
 _classes   Log::Report::Message  undef
 _context   Log::Report::Message  undef
 _count     Log::Report::Message  undef
 _domain    Log::Report::Message  <from "use Log::Report">
 _expand    Log::Report::Message  false
 _join      Log::Report::Message  $" $LIST_SEPARATOR
 _lang      Log::Report::Message  <from locale>
 _msgctxt   Log::Report::Message  undef
 _msgid     Log::Report::Message  undef
 _plural    Log::Report::Message  undef
 _prepend   Log::Report::Message  undef
 _tag       Log::Report::Message  []
 _tags      Log::Report::Message  []
 _to        Log::Report::Message  undef
 reason                           undef
_append => $text|$message
_category => INTEGER
_class => $tags|\@tags
_classes => $tags|\@tags
_context => $keyword|\@keywords
_count => INTEGER|ARRAY|HASH
_domain => $name|$object
_expand => BOOLEAN
_join => $separator
_lang => ISO
_msgctxt => $context
_msgid => $msgid
_plural => $msgid
_prepend => $text|$message
_tag => $tags|\@tags
_tags => $tags|\@tags
_to => $dispatcher
reason => $reason

The $reason reflects the exception level which is attached to message, often derived from a caught exception.

Attributes

Extends "Attributes" in Log::Report::Message.

$obj->addTags(@tags)

Inherited, see "Attributes" in Log::Report::Message

$obj->append()

Inherited, see "Attributes" in Log::Report::Message

$obj->bootstrapColor()

[2.03] Get a suitable bootstrap context color for the message. This can be used as per the SYNOPSIS.

CSS class success is used for Dancer2::Plugin::LogReport::success() messages, info colors are used for messages notice and below, warning is used for warning and mistake, danger is used for all other messages.

$obj->bootstrap_color()

Deprecated. See bootstrapColor().

$obj->classes()

Inherited, see "Attributes" in Log::Report::Message

$obj->context()

Inherited, see "Attributes" in Log::Report::Message

$obj->count()

Inherited, see "Attributes" in Log::Report::Message

$obj->domain()

Inherited, see "Attributes" in Log::Report::Message

$obj->errno( [$errno] )

Inherited, see "Attributes" in Log::Report::Message

$obj->msgctxt()

Inherited, see "Attributes" in Log::Report::Message

$obj->msgid()

Inherited, see "Attributes" in Log::Report::Message

$obj->prepend()

Inherited, see "Attributes" in Log::Report::Message

$obj->reason( [$reason] )

Get or set the reason of a message.

$obj->tags()

Inherited, see "Attributes" in Log::Report::Message

$obj->to( [$name] )

Inherited, see "Attributes" in Log::Report::Message

$obj->valueOf($parameter)

Inherited, see "Attributes" in Log::Report::Message

Processing

Extends "Processing" in Log::Report::Message.

$obj->concat( $text|$message, [$prepend] )

Inherited, see "Processing" in Log::Report::Message

$obj->freeze(%options)

Inherited, see "Processing" in Log::Report::Message

$obj->inClass($tag|Regexp)

Inherited, see "Processing" in Log::Report::Message

$obj->taggedWith($tag|Regexp)

Inherited, see "Processing" in Log::Report::Message

$class->thaw(\%data, %options)

Inherited, see "Processing" in Log::Report::Message

$obj->toHTML( [$locale] )

Inherited, see "Processing" in Log::Report::Message

$obj->toString( [$locale] )

Inherited, see "Processing" in Log::Report::Message

$obj->untranslated()

Inherited, see "Processing" in Log::Report::Message

Serialization

[2.03] Log messages are/can be stored in the Session object. The Session object may be cached in a file, in various formats. To be able to save and restore these message objects from this session serialization, we need to freeze and thaw the object at the right moment. This happens transparently.

For session serialization in the database, put this in your configuration:

engines:
  session:
    DBIC:
      serializer: JSON
      serialize_options:
        allow_tags: 1
      deserialize_options:
        allow_tags: 1
$obj->FREEZE($serializer)

JSON (both JSON::XS and JSON::PP) and Sereal should work as $serializer: they both support the CBOR::XS interface.

$class->THAW($serializer, $msg)

DETAILS

Extends "DETAILS" in Log::Report::Message.

SEE ALSO

This module is part of Dancer2-Plugin-LogReport version 2.03, built on April 13, 2026. Website: http://perl.overmeer.net/CPAN/

LICENSE

For contributors see file ChangeLog.

This software is copyright (c) 2015-2026 by Mark Overmeer.

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