- COPYRIGHT AND LICENSE
Log::Any::Plugin::Encode - Output message encoding for log adapters
# 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.
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 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.
Defaults to 'utf8' if not specified. An unknown encoding will throw an error.
There are no methods in this package which should be directly called by the user. Use Log::Any::Plugin->add() instead.
Private method called by Log::Any::Plugin->add()
Thanks to Strategic Data for sponsoring the development of this module.
Stephen Thirlwall <email@example.com>
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.