Log-LogMethods

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "runtime" : {
         "requires" : {
            "B" : "1.68",
            "Carp" : "1.42",
            "Data::Dumper" : "2.161",
            "Data::Result" : "1.0",
            "Exporter" : "5.72",
            "IO::Scalar" : "2.111",
            "Log::Dispatch::Handle" : "2.65",
            "Log::Log4perl" : "1.49",
            "Modern::Perl" : "1.20170117",
            "Moo" : "2.003002",
            "MooX::Types::MooseLike::Base" : "0.29",
            "Ref::Util" : "0.203",
            "Scalar::Util" : "1.48",
            "Test::More" : "1.302073",
            "Time::HiRes" : "1.9741",
            "namespace::clean" : "0.27",
            "overload" : "1.28"
         }
      }

META.yml  view on Meta::CPAN

    - inc
requires:
  B: '1.68'
  Carp: '1.42'
  Data::Dumper: '2.161'
  Data::Result: '1.0'
  Exporter: '5.72'
  IO::Scalar: '2.111'
  Log::Dispatch::Handle: '2.65'
  Log::Log4perl: '1.49'
  Modern::Perl: '1.20170117'
  Moo: '2.003002'
  MooX::Types::MooseLike::Base: '0.29'
  Ref::Util: '0.203'
  Scalar::Util: '1.48'
  Test::More: '1.302073'
  Time::HiRes: '1.9741'
  namespace::clean: '0.27'
  overload: '1.28'
version: '1.010'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Log::LogMethods',
    VERSION_FROM      => 'lib/Log/LogMethods.pm', # finds $VERSION
    LICENSE=>'perl_5',
    PREREQ_PM         => {
    qw(
      Moo  2.003002
      overload 1.28
      Modern::Perl 1.20170117
      MooX::Types::MooseLike::Base 0.29
      Carp 1.42
      namespace::clean 0.27
      Data::Dumper  2.161
      Test::More    1.302073
      Data::Result  1.0
      Log::Log4perl 1.49
      Time::HiRes   1.9741
      B             1.68
      Scalar::Util  1.48

lib/Log/LogMethods.pm  view on Meta::CPAN

package Log::LogMethods;

use Modern::Perl;
use Time::HiRes qw(tv_interval gettimeofday);
use Ref::Util qw(is_plain_hashref is_blessed_hashref);
use Scalar::Util qw(blessed);
use B qw(svref_2object);
use Scalar::Util qw(looks_like_number);
no warnings 'redefine';
use Log::Log4perl;
use Log::Log4perl::Level;
Log::Log4perl->wrapper_register(__PACKAGE__);
use Moo::Role;

lib/Log/LogMethods/Log4perlLogToString.pm  view on Meta::CPAN

=cut

=head1 Exports

All functions and variables are exported by default, if you only want to import a single funciton, just provide the statement in the use list.

=over 4

=cut

use Modern::Perl;
use Exporter qw(import);
use IO::Scalar;
use Log::LogMethods;
use Log::Log4perl::Appender;
use Log::Log4perl::Layout::PatternLayout;
use Log::Dispatch::Handle;
Log::Log4perl->wrapper_register(__PACKAGE__);
our $VERSION=$Log::LogMethods::VERSION;

our @EXPORT=qw(LoggerToString LoggerToFh $DEFAULT_LAYOUT);

t/Log-LogMethods-GeneratedInterfaces.t  view on Meta::CPAN

use Modern::Perl;
use Test::More;
use Log::LogMethods::Log4perlLogToString;
use Data::Dumper;
use Carp qw(confess);
BEGIN { $SIG{__DIE__} = sub { confess @_ }; }

my $string='';
my $class='Log::LogMethods';
my $log=LoggerToString($class,$string,"$Log::LogMethods::Log4perlLogToString::DEFAULT_LAYOUT");
#my $log=LoggerToFh($class,*STDERR,"# $Log::LogMethods::Log4perlLogToString::DEFAULT_LAYOUT");

t/Log-LogMethods-GeneratedInterfaces.t  view on Meta::CPAN

    $string='';
    $self->test('info',"this is a test");
    my $re=qr{INFO \d+ test::test};
    like($string,$re,'Make sure we log the correct function and line');
    diag $string;
  }
}

{
  package test;
  use Modern::Perl;
  use Moo;
  BEGIN { with 'Log::LogMethods'; }
  sub test {
   my ($self,$method,$msg)=@_;
     $self->$method($msg);
  }
}


done_testing;

t/Log-LogMethods-Log4PerlLogToString.t  view on Meta::CPAN

use Modern::Perl;

use Test::More qw(no_plan);
my $class='Log::LogMethods::Log4perlLogToString';
require_ok($class);
use_ok($class);

done_testing;

t/Log-LogMethods.t  view on Meta::CPAN

use Modern::Perl;
no warnings 'redefine';
use Test::More qw(no_plan);
use IO::Scalar;
use Data::Dumper;
use Data::Result;
use Log::Log4perl;
use Log::Log4perl::Layout;
use Log::Log4perl::Level;
use Log::Dispatch;
use Log::LogMethods::Log4perlLogToString;

t/Log-LogMethods.t  view on Meta::CPAN

  sub res_debug : BENCHMARK_DEBUG { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }

  sub result_always : RESULT_ALWAYS { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }
  sub result_error : RESULT_ERROR { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }
  sub result_warn : RESULT_WARN { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }
  sub result_info : RESULT_INFO { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }
  sub result_debug : RESULT_DEBUG { shift;@DATA=@_; wantarray ? (@_) : $_[0]  }
}
{
  package src_test_parent;
  use Modern::Perl;
  use constant log_header=>'AUTO LOG HEADER TEST';
  use base qw(test_parent);
  1;
}

## UNIT TESTING STOPS HERE!
done_testing;

## END OF THE SCRIPT

t/levelOrder.t  view on Meta::CPAN

use Modern::Perl;
use Test::More qw(no_plan);
use Data::Dumper;
require Log::LogMethods;

my @order=sort { $Log::LogMethods::LEVEL_MAP{$b} <=> $Log::LogMethods::LEVEL_MAP{$a} } keys %Log::LogMethods::LEVEL_MAP;

my @cmp=(qw(
  OFF
  ALWAYS
  FATAL



( run in 0.539 second using v1.01-cache-2.11-cpan-a5abf4f5562 )