Skip to content

Commit d678a93

Browse files
committed
config and logging
1 parent 5a38f26 commit d678a93

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

bin/author.pl

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package Author;
88
use Email::Valid ();
99
use Encode ();
1010
use Getopt::Long;
11-
use Log::Contextual::Easy::Default qw< :log :dlog >;
11+
use MetaCPAN::Logger qw< :log :dlog >;
1212
use URI ();
1313
use XML::Simple qw< XMLin >;
1414

@@ -17,6 +17,7 @@ package Author;
1717
author_dir
1818
cpan_dir
1919
diff_struct
20+
config
2021
>;
2122

2223
# config
@@ -54,8 +55,8 @@ package Author;
5455
my $pauseid;
5556
GetOptions( "pauseid=s" => \$pauseid );
5657

57-
### TODO - move out
58-
$ENV{AUTHOR_UPTO} = "TRACE";
58+
my $config = config();
59+
$config->init_logger;
5960

6061
# setup
6162
my $cpan = cpan_dir();

lib/MetaCPAN/Ingest.pm

+12
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ use warnings;
66
use Path::Tiny qw< path >;
77
use Ref::Util qw< is_ref is_plain_arrayref is_plain_hashref >;
88
use LWP::UserAgent;
9+
use MetaCPAN::Config;
910

1011
use Sub::Exporter -setup => {
1112
exports => [
1213
qw<
14+
config
1315
author_dir
1416
cpan_dir
1517
diff_struct
@@ -18,6 +20,16 @@ use Sub::Exporter -setup => {
1820
]
1921
};
2022

23+
my $config;
24+
sub config {
25+
$config //= do {
26+
MetaCPAN::Config->new(
27+
name => __PACKAGE__,
28+
path => path(__FILE__)->parent(3)->stringify,
29+
);
30+
};
31+
}
32+
2133
sub author_dir {
2234
my $pauseid = shift;
2335
my $dir = 'id/'

log4perl.conf

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
log4perl.rootLogger=DEBUG, OUTPUT
2+
3+
log4perl.appender.OUTPUT=Log::Log4perl::Appender::Screen
4+
log4perl.appender.OUTPUT.stderr=1
5+
6+
log4perl.appender.OUTPUT.layout=PatternLayout
7+
log4perl.appender.OUTPUT.layout.ConversionPattern=[%d] [%p] %m%n

metacpan_ingest.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
log4perl_file log4perl.conf
2+
3+
# cpan ./CPAN

0 commit comments

Comments
 (0)