File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 54
54
55
55
'logging ' => env ('LDAP_LOGGING ' , true ),
56
56
57
+ 'logging_channel ' => env ('LOG_CHANNEL ' , 'stack ' ),
58
+
57
59
/*
58
60
|--------------------------------------------------------------------------
59
61
| LDAP Cache
Original file line number Diff line number Diff line change @@ -82,9 +82,16 @@ protected function registerLogging()
82
82
return ;
83
83
}
84
84
85
- if (! is_null ($ logger = Log::getFacadeRoot ())) {
86
- Container::getInstance ()->setLogger ($ logger );
85
+ /** @var \Illuminate\Log\LogManager|null $logger */
86
+ if (is_null ($ logger = Log::getFacadeRoot ())) {
87
+ return ;
87
88
}
89
+
90
+ Container::getInstance ()->setLogger (
91
+ ($ channel = Config::get ('ldap.logging_channel ' ))
92
+ ? $ logger ->channel ($ channel )
93
+ : $ logger
94
+ );
88
95
}
89
96
90
97
/**
Original file line number Diff line number Diff line change 2
2
3
3
namespace LdapRecord \Laravel \Tests \Unit ;
4
4
5
- use Illuminate \Log \LogManager ;
6
5
use LdapRecord \Connection ;
7
6
use LdapRecord \Container ;
8
7
use LdapRecord \Laravel \LdapServiceProvider ;
9
8
use LdapRecord \Laravel \Tests \TestCase ;
10
9
use LdapRecord \Query \Cache ;
10
+ use Psr \Log \LoggerInterface ;
11
11
12
12
class LdapServiceProviderTest extends TestCase
13
13
{
@@ -64,7 +64,7 @@ public function test_config_is_publishable()
64
64
65
65
public function test_logger_is_set_on_container_when_enabled ()
66
66
{
67
- $ this ->assertInstanceOf (LogManager ::class, Container::getInstance ()->getLogger ());
67
+ $ this ->assertInstanceOf (LoggerInterface ::class, Container::getInstance ()->getLogger ());
68
68
}
69
69
70
70
public function test_cache_is_set_on_connection_when_enabled ()
@@ -143,6 +143,7 @@ public function test_env_config_is_loaded_and_cacheable()
143
143
],
144
144
],
145
145
'logging ' => true ,
146
+ 'logging_channel ' => 'stack ' ,
146
147
'cache ' => [
147
148
'enabled ' => true ,
148
149
'driver ' => 'array ' ,
You can’t perform that action at this time.
0 commit comments