NAME
Log::Any::Plugin::Encode - Output message encoding for log adapters
VERSION
version 0.010
SYNOPSIS
# Set up some kind of logger.
use Log::Any::Adapter;
Log::Any::Adapter->set('SomeAdapter');
# Apply the Levels plugin to your logger
use Log::Any::Plugin;
Log::Any::Plugin->add('Encode', encoding => 'utf8'); # utf8 is default if not specified
# In your modules
use Log::Any qw($log);
$log->error('error'); # output is <encoding> encoded, in this case UTF-8
# Applies to every log method.
DESCRIPTION
This came about from noticing warnings of wide chars being output to adapter streams. This plugin may be inserted as needed to explicitly transform log messages into the configured encoding.
CONFIGURATION
Configuration values are passed as key-value pairs when adding the plugin:
Log::Any::Plugin->add('Encode', encoding => 'utf8');
This implementation relies on the Encode module to perform encoding, refer to that for supported encodings.
encoding => $encoding
Defaults to 'utf8' if not specified. An unknown encoding will throw an error.
METHODS
There are no methods in this package which should be directly called by the user. Use Log::Any::Plugin->add() instead.
install
Private method called by Log::Any::Plugin->add()
ACKNOWLEDGEMENTS
Thanks to Strategic Data for sponsoring the development of this module.
AUTHOR
Stephen Thirlwall <sdt@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019, 2017, 2016, 2015, 2014, 2013, 2011 by Stephen Thirlwall.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.