-Log
Specifies log level.
use Catalyst qw/
-Log=info
... foreach (@arguments) {
if (/^-Debug$/) {
$flags->{log} =
( $flags->{log} ) ? 'debug,' . $flags->{log} : 'debug';
}
elsif (/^-(\w+)=?(.*)$/) {
$flags->{ lc $1 } = $2;
}
else {
push @{ $flags->{plugins} }, $_;
}
}
... 略 ...
$class->setup_log( delete $flags->{log} );sub setup_log {
my ( $class, $debug ) = @_;
unless ( $class->log ) {
$class->log( Catalyst::Log->new );
}
my $app_flag = Catalyst::Utils::class2env($class) . '_DEBUG';
if (
( defined( $ENV{CATALYST_DEBUG} ) || defined( $ENV{$app_flag} ) )
? ( $ENV{CATALYST_DEBUG} || $ENV{$app_flag} )
: $debug
)
{
no strict 'refs';
*{"$class\::debug"} = sub { 1 };
$class->log->debug('Debug messages enabled');
}
}+if( ! defined $ENV{CATALYST_DEBUG} ){
+ $ENV{CATALYST_DEBUG} = 0;
+}
+
__PACKAGE__->setup;
+if( $ENV{CATALYST_DEBUG} == 0 ){
+ __PACKAGE__->log->disable('debug');
+}
+これで,script/myapp_server.pl を -d オプションなしで実行すれば,デバッグメッセージは出なくなります.-d オプションを付けるか,環境変数で CATALYST_DEBUG=1 とやれば,デバッグメッセージが出力されます.でも,なんとなくかっこ悪い...
もっとスマートな方法がきっとあるはずですよね.教えて Catalyst の偉いひと!
カテゴリ:開発日記
いかちょー (2007-06-22 21:47) | コメント(0)| トラックバック(7)
トラックバックURL:
Generic oxycontin 40mg. - Generic oxycontin 40mg. (2011年2月26日 19:18)
Generic oxycontin 40mg. 続きを読む
Percocet and heartburn. - Percocet and heartburn. (2011年2月27日 03:08)
Percocet and heartburn. 続きを読む
Buy watson soma. - Buy online soma watson. (2011年2月27日 23:13)
Buy watson soma. Buy watson soma online. Buy online soma watson. 続きを読む
But oxycontin online. - But oxycontin online. (2011年2月28日 04:42)
But oxycontin online. 続きを読む
Buy watson soma. - Buy watson soma. (2011年2月28日 16:18)
Buy watson soma. 続きを読む
Buena vista soma. - Buena vista soma. (2011年3月 1日 00:43)
Buena vista soma. 続きを読む
.. - .. (2011年3月 1日 08:29)
.. 続きを読む
月別アーカイブ
Copyright (C) 2004-2011 Nihon Unisys, Ltd. All Rights Reserved.
Powered by Movable Type Open Source