Data::AnyXfer::Elastic::Logger
my $logger = Data::AnyXfer::Elastic::Logger->new( dir => 'Str|Path::Class::Dir', # optional options => { # optional screen => {}, file_rotate => {}, }, screen => 0, # false by default file => 1, # true by default ); # alias = employees my $datafile1 = Datafile->new( file => 'employees.datafile' ); # by default will log to ../elasticsearch/logs/dd-mm-yyyy/employees $logger->debug( index_info => $datafile1, text => 'Blah Blah Blah!', content => \@errors ); # alias = interiors my $datafile2 = Datafile->new( file => 'interiors.datafile' ); # by default will log to ../elasticsearch/logs/dd-mm-yyyy/interiors $logger->critical( index_info => $datafile2, text => 'Oops! Something went wrong!', content => Search::Elasticsearch::Error::Request->new; );
This module is based of Log::Dispatch to log Elasticsearch events and errors.
Defines the directory location of logging. Defaults to CWD/logs/yyyy-mm-dd/alias_name.
CWD
Log to file. Defaults to true.
Log to screen. Defaults to false.
These define the options for Log::Dispatch::Screen and Log::Dispatch::Screen please refer to their documentation. Note that for FileRotate the arguement filename will be overwritten.
Log::Dispatch::Screen
Must be in the format:
{ screen => { Log::Dispatch::Screen options } file_rotate => { Log::Dispatch::FileRotate options } }
my %args = ( index_info => $df, text => '', content => $struct ); $logger->debug( %args ); $logger->info( %args ); $logger->notice( %args ); $logger->warning( %args ); $logger->error( %args ); $logger->critical( %args ); $logger->alert( %args ); $logger->emergency( %args );
All logging methods have the arguements: index_info, text and content. Content can be either a perl data structure or a Search::Elasticsearch::Error::Request object.
Search::Elasticsearch::Error::Request
This software is copyright (c) 2019, Anthony Lucas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::AnyXfer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::AnyXfer
CPAN shell
perl -MCPAN -e shell install Data::AnyXfer
For more information on module installation, please visit the detailed CPAN module installation guide.