[libcatmandu-perl] 57/85: Adding a basic Log::Any::Adapter::Stderr for the command line
Jonas Smedegaard
dr at jones.dk
Tue May 20 09:56:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.91
in repository libcatmandu-perl.
commit 9bc619b1066ab4178f973f024a3935bc92a04b40
Author: Patrick Hochstenbach <patrick.hochstenbach at ugent.be>
Date: Fri May 16 15:00:53 2014 +0200
Adding a basic Log::Any::Adapter::Stderr for the command line
---
README.md | 5 +++--
bin/catmandu | 8 +++++++-
lib/Catmandu/CLI.pm | 7 +++++++
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index d82a7d5..3ed8dec 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ such as MongoDB and full text indexes such as Solr to create a rapid
development environment for digital library services such as institutional
repositories and search engines.
-In the [http://librecat.org/|LibreCat](http://librecat.org/|LibreCat) project it is our goal to provide an
+In the [http://librecat.org/](http://librecat.org/) project it is our goal to provide an
open source set of programming components to build up digital libraries
services suited to your local needs.
@@ -103,7 +103,8 @@ See [Config::Onion](https://metacpan.org/pod/Config::Onion) for more information
## log
Return the current logger (the [Log::Any::Adapter](https://metacpan.org/pod/Log::Any::Adapter) for category
-[Catmandu::Env](https://metacpan.org/pod/Catmandu::Env)).
+[Catmandu::Env](https://metacpan.org/pod/Catmandu::Env)). See [Log::Any#Logging](https://metacpan.org/pod/Log::Any#Logging) for how to send messages to the
+logger.
E.g. turn on Log4perl logging in your application;
diff --git a/bin/catmandu b/bin/catmandu
index f41f07f..ad57a1c 100755
--- a/bin/catmandu
+++ b/bin/catmandu
@@ -13,7 +13,7 @@ catmandu - LibreCat command line tools
=head1 SYNOPSIS
- catmandu [COMMAND] [-?hqv] [long options...] [ARGS]
+ catmandu [-I path] [-L path] [-d] [COMMAND] [-?hqv] [long options...] [ARGS]
catmandu help data
@@ -57,6 +57,12 @@ Verbose output.
Display the help screen.
+=item --debug
+
+=item -d
+
+Display debug messages.
+
=item --lib-path PATH
=item -I
diff --git a/lib/Catmandu/CLI.pm b/lib/Catmandu/CLI.pm
index 374a224..3f0365a 100644
--- a/lib/Catmandu/CLI.pm
+++ b/lib/Catmandu/CLI.pm
@@ -3,6 +3,7 @@ package Catmandu::CLI;
use Catmandu::Sane;
use App::Cmd::Setup -app;
use Catmandu::Util;
+use Log::Any::Adapter;
use Catmandu;
sub VERSION {
@@ -15,6 +16,7 @@ sub global_opt_spec {
(
['load_path|L=s@', ""],
['lib_path|I=s@', ""],
+ ['debug|d',""],
);
}
@@ -27,6 +29,7 @@ sub run {
my $load_path = $global_opts->{load_path} || [];
my $lib_path = $global_opts->{lib_path} || [];
+ my $debug = $global_opts->{debug};
Catmandu->load(@$load_path);
@@ -34,6 +37,10 @@ sub run {
Catmandu::Util::use_lib(@$lib_path);
}
+ if (defined $debug) {
+ Log::Any::Adapter->set('Stderr');
+ }
+
my $self = ref $class ? $class : $class->new;
$self->set_global_options($global_opts);
my ($cmd, $opts, @args) = $self->prepare_command(@$argv);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-perl.git
More information about the Pkg-perl-cvs-commits
mailing list