NAME
Log::Message::Structured::Component::Date
SYNOPSIS
package MyLogEvent;
use Moose;
use namespace::autoclean;
# Note: you MUST compose these together as they depend on methods in each other
with qw/
Log::Message::Structured
/;
# Components must be consumed seperately
with qw/
Log::Message::Structured::Component::Date
/;
has foo => ( is => 'ro', required => 1 );
... elsewhere ...
use aliased 'My::Log::Event';
$logger->log(message => Event->new( foo => "bar" ));
# Logs:
{"__CLASS__":"MyLogEvent","foo":1,"date":"2010-03-28T23:15:52Z"}
DESCRIPTION
Provides a 'date'
attribute to the consuming class ( probably Log::Message::Structured), representing the epoch time in ISO8601.
Requires the epochtime
attribute (Log::Message::Structured provides it).
METHODS
BUILD
The BUILD method is wrapped to make sure the date is inflated at construction time.
ATTRIBUTES
date
The date and time on which the event occured, as an ISO8601 date time string (from MooseX::Types::ISO8601). Defaults to the time the object is constructed.
AUTHOR AND COPYRIGHT
Damien Krotkine (dams) <dams@cpan.org>
.
LICENSE
Licensed under the same terms as perl itself.