Mojolicious::Plugin::Log::Timestamp - Provide customised log timestamps
# Mojolicious $self->plugin('Log::Timestamp'); # Mojolicious::Lite plugin 'Log::Timestamp';
Mojolicious::Plugin::Log::Timestamp is a Mojolicious plugin for customising log timestamps in your web application.
Simply add the plugin as shown above and you will get fairly compact ISO-style timestamps as '%Y%m%d %H:%M:%S'. To set a custom timestamp pattern, just pass it to the plugin.
# Mojolicious $self->plugin('Log::Timestamp' => {pattern => '%F %X '}); # Mojolicious::Lite plugin 'Log::Timestamp' => {pattern => '%F %X '};
See Mojar::Log for more examples. If you want ISO 8601, use '%FT%X ', optionally omitting the 'T'. Trailing whitespace is significant. If you want ultra compact, try '%y%m%d%H%M%S'.
In addition to 'pattern', you can include any of the usual Mojo::Log parameters such as 'path' and 'level'.
Mojolicious::Plugin::Log::Timestamp inherits all methods from Mojolicious::Plugin.
$plugin->register(Mojolicious->new);
Register plugin in Mojolicious application.
Usually you want your log timestamps to just do their job in the fewest characters practical. And everyone is entitled to their own view as to what a log timestamp should look like. Personally I usually choose '%y%m%d %X'. But none of this deservers absorbing your attention, so you just use the plugin and get on with the real work.
Copyright (C) 2014, Nic Sandfield.
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
Mojar::Log, Mojo::Log, Mojolicious::Plugin::Log::Access, Mojolicious::Guides.
To install Mojolicious::Plugin::Log::Timestamp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Log::Timestamp
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Log::Timestamp
For more information on module installation, please visit the detailed CPAN module installation guide.