forked from LiveCarta/PayPal-PHP-Server-SDK
Automated commit message (#9)
Co-authored-by: PayPalServerSDKs <server-sdks@paypal.com>
This commit is contained in:
@@ -19,25 +19,25 @@ Represents the logging configurations for API calls. Create instance using `Logg
|
||||
|
||||
In order to provide custom logger, any implementation of the `Psr\Log\LoggerInterface` can be used so that you can override the `log` behavior and provide its instance directly in the SDK client initialization.
|
||||
|
||||
The following example uses `Monolog\Logger` implementation of `Psr\Log\LoggerInterface` for PaypalServerSDKClient initialization.
|
||||
The following example uses `Monolog\Logger` implementation of `Psr\Log\LoggerInterface` for PaypalServerSdkClient initialization.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
use PaypalServerSDKLib\PaypalServerSDKClientBuilder;
|
||||
use PaypalServerSDKLib\Logging\LoggingConfigurationBuilder;
|
||||
use PaypalServerSDKLib\Logging\RequestLoggingConfigurationBuilder;
|
||||
use PaypalServerSDKLib\Logging\ResponseLoggingConfigurationBuilder;
|
||||
use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
|
||||
use PaypalServerSdkLib\Logging\LoggingConfigurationBuilder;
|
||||
use PaypalServerSdkLib\Logging\RequestLoggingConfigurationBuilder;
|
||||
use PaypalServerSdkLib\Logging\ResponseLoggingConfigurationBuilder;
|
||||
use Psr\Log\LogLevel;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
||||
// create a log channel
|
||||
$logger = new Logger('PaypalServerSDK');
|
||||
$logger = new Logger('PaypalServerSdk');
|
||||
$logger->pushHandler(new StreamHandler(__DIR__ . '/api_data.log'));
|
||||
|
||||
// initialize the sdk client using this logger
|
||||
$client = PaypalServerSDKClientBuilder::init()
|
||||
$client = PaypalServerSdkClientBuilder::init()
|
||||
->loggingConfiguration(
|
||||
LoggingConfigurationBuilder::init()
|
||||
->logger($logger)
|
||||
|
||||
Reference in New Issue
Block a user