File tree Expand file tree Collapse file tree
src/Illuminate/Foundation
tests/Integration/Foundation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ public static function configureCloudLogging(Application $app): void
186186 'includeStacktraces ' => true ,
187187 ]);
188188
189- $ app [ ' config ' ]-> set ( ' logging.channels.laravel-cloud-socket ' , [
189+ $ channel = [
190190 'driver ' => 'monolog ' ,
191191 'level ' => $ _ENV ['LOG_LEVEL ' ] ?? $ _SERVER ['LOG_LEVEL ' ] ?? 'debug ' ,
192192 'handler ' => SocketHandler::class,
@@ -198,7 +198,13 @@ public static function configureCloudLogging(Application $app): void
198198 'connectionString ' => Cloud::socket (),
199199 'persistent ' => true ,
200200 ],
201- ]);
201+ ];
202+
203+ $ app ['config ' ]->set ('logging.channels.laravel-cloud-socket ' , $ channel );
204+
205+ if (! $ app ['config ' ]->has ('logging.channels.cloud ' )) {
206+ $ app ['config ' ]->set ('logging.channels.cloud ' , $ channel );
207+ }
202208 }
203209
204210 /**
Original file line number Diff line number Diff line change @@ -100,4 +100,29 @@ public function test_it_respects_log_levels()
100100 $ _SERVER ['LOG_LEVEL ' ] = $ logLevelBackup ;
101101 }
102102 }
103+
104+ public function test_it_aliases_cloud_logging_channel ()
105+ {
106+ Cloud::configureCloudLogging ($ this ->app );
107+
108+ $ this ->assertSame (
109+ $ this ->app ['config ' ]->get ('logging.channels.laravel-cloud-socket ' ),
110+ $ this ->app ['config ' ]->get ('logging.channels.cloud ' )
111+ );
112+ }
113+
114+ public function test_it_does_not_replace_existing_cloud_logging_channel ()
115+ {
116+ $ this ->app ['config ' ]->set ('logging.channels.cloud ' , [
117+ 'driver ' => 'single ' ,
118+ 'path ' => 'test.log ' ,
119+ ]);
120+
121+ Cloud::configureCloudLogging ($ this ->app );
122+
123+ $ this ->assertSame ([
124+ 'driver ' => 'single ' ,
125+ 'path ' => 'test.log ' ,
126+ ], $ this ->app ['config ' ]->get ('logging.channels.cloud ' ));
127+ }
103128}
You can’t perform that action at this time.
0 commit comments