OSDN Git Service

check Log.backtrace config variable to output backtrace or not
authorhylom <hylom@users.sourceforge.jp>
Fri, 1 Dec 2017 13:04:41 +0000 (22:04 +0900)
committerhylom <hylom@users.sourceforge.jp>
Fri, 1 Dec 2017 13:04:41 +0000 (22:04 +0900)
src/newslash_web/lib/Newslash/Web.pm

index 7a6eff0..5ec125e 100644 (file)
@@ -1,7 +1,6 @@
 package Newslash::Web;
 use Mojo::Base 'Mojolicious';
 use Mojo::Util qw(dumper);
-use Carp::Always;
 
 use Newslash::Model;
 
@@ -22,6 +21,11 @@ sub startup {
     }
     # TODO: load/save configs with database
 
+    if ($app->config->{Log} && $app->config->{Log}->{backtrace}) {
+        require Carp::Always;
+        Carp::Always->import;
+    }
+
     # set log file
     if ($app->config->{Log} && $app->config->{Log}->{system_log}) {
         # check log is writable