From 8cf8d32866e05fd07dcc71c6ea18ee87efbea45c Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Tue, 8 Jul 2014 10:04:18 +0300 Subject: [PATCH] Add --logfile argument --- edwardng | 10 +++++++++- lib/App/EdwardNG.pm | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/edwardng b/edwardng index 4f6124e..090a937 100755 --- a/edwardng +++ b/edwardng @@ -20,7 +20,7 @@ Manually: In F: - edwardng: |edwardng --from=edwardng@example.org --key=12345678 + edwardng: |edwardng --from=edwardng@example.org --key=12345678 --keydir=/srv/edwardng-keydir --debug --logfile=/var/log/edwardng =head1 DESCRIPTION @@ -52,6 +52,10 @@ ID of key used for encrypting replies. Path to GnuPG homedir. +=item B<--logfile>=I + +If B<--debug>, append debug information to this file. Ignored if B<--no-debug>. + =item B<--passphrase>=I Private key passphrase. @@ -92,6 +96,10 @@ Corresponds to B<--key>. Corresponds to B<--keydir>. +=item EDWARDNG_LOGFILE + +Corresponds to B<--logfile>. + =item EDWARDNG_PASSPHRASE Corresponds to B<--passphrase>. diff --git a/lib/App/EdwardNG.pm b/lib/App/EdwardNG.pm index 4da1968..8343b47 100644 --- a/lib/App/EdwardNG.pm +++ b/lib/App/EdwardNG.pm @@ -96,11 +96,13 @@ sub run { 'from=s' => \$ENV{EDWARDNG_FROM}, 'key=s' => \$ENV{EDWARDNG_KEY}, 'keydir=s' => \$ENV{EDWARDNG_KEYDIR}, + 'logfile=s' => \$ENV{EDWARDNG_LOGFILE}, 'passphrase=s' => \$ENV{EDWARDNG_PASSPHRASE}, 'tmpl-path=s' => \$ENV{EDWARDNG_TMPL_PATH}, 'use-agent!' => \$ENV{EDWARDNG_USE_AGENT}, ); my $tmpl_path = $ENV{EDWARDNG_TMPL_PATH} // 'en'; + open STDERR, '>>', $ENV{EDWARDNG_LOGFILE} if $ENV{EDWARDNG_LOGFILE}; my $parser = MIME::Parser->new; $parser->decode_bodies(0); -- 2.39.2