Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp
[kivitendo-erp.git] / SL / DBConnect.pm
1 package SL::DBConnect;
2
3 use strict;
4
5 use DBI;
6
7 sub connect {
8   shift;
9
10   return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl};
11
12   require Log::Log4perl;
13   require DBIx::Log4perl;
14
15   my $filename =  $::lxdebug->file;
16   my $config   =  $::lx_office_conf{debug}->{dbix_log4perl_config};
17   $config      =~ s/LXDEBUGFILE/${filename}/g;
18
19   Log::Log4perl->init(\$config);
20   return DBIx::Log4perl->connect(@_);
21 }
22
23 1;