File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1515 "php" : " ^8.1" ,
1616 "illuminate/cache" : " ^10.0 || ^11.0" ,
1717 "illuminate/console" : " ^10.0 || ^11.0" ,
18- "illuminate/support" : " ^10.0 || ^11.0" ,
19- "monolog/monolog" : " ^3.0"
18+ "illuminate/support" : " ^10.0 || ^11.0"
2019 },
2120 "require-dev" : {
2221 "friendsofphp/php-cs-fixer" : " ^3.50" ,
Original file line number Diff line number Diff line change 1212 | Here you may configure the log settings for when a location is not found
1313 | for the IP provided.
1414 |
15+ | Requires Monolog to be installed: `composer install monolog/monolog`
16+ |
1517 */
1618
1719 'log_failures ' => true ,
Original file line number Diff line number Diff line change 44
55namespace InteractionDesignFoundation \GeoIP ;
66
7- use Monolog \Logger ;
87use Illuminate \Support \Arr ;
98use Illuminate \Cache \CacheManager ;
10- use Monolog \Handler \StreamHandler ;
119
1210/**
1311 * @psalm-import-type LocationArray from \InteractionDesignFoundation\GeoIP\Location
@@ -148,8 +146,16 @@ private function find($ip = null): Location
148146 return $ location ;
149147 } catch (\Exception $ e ) {
150148 if ($ this ->config ('log_failures ' , true ) === true ) {
151- $ log = new Logger ('geoip ' );
152- $ log ->pushHandler (new StreamHandler (storage_path ('logs/geoip.log ' ), Logger::ERROR ));
149+ if (! class_exists (\Monolog \Logger::class)) {
150+ throw new \RuntimeException (
151+ 'monolog/monolog composer package is not installed, but required with the enabled geoip.log_failures config option. ' ,
152+ 0 ,
153+ $ e
154+ );
155+ }
156+
157+ $ log = new \Monolog \Logger ('geoip ' );
158+ $ log ->pushHandler (new \Monolog \Handler \StreamHandler (storage_path ('logs/geoip.log ' ), \Monolog \Logger::ERROR ));
153159 $ log ->error ($ e );
154160 }
155161 }
You can’t perform that action at this time.
0 commit comments