Skip to content

Commit 15fc9ec

Browse files
committed
Merge branch 'develop'
# Conflicts: # composer.json [SOLVED]
2 parents 90c9245 + aa410d6 commit 15fc9ec

8 files changed

+28
-18
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ $context['stackdriver'] = [
4040

4141
If you need to, you can override this key name by setting `$entryOptionsWrapper` to your own value (string) when using `StackdriverHandler::__construct`.
4242

43+
It is also possible to set path to credentials and project id via the global constant.
44+
```php
45+
define('GOOGLE_APPLICATION_CREDENTIALS', '/path/to/service-account-key-file.json');
46+
define('GOOGLE_CLOUD_PROJECT', 'eg-my-project-id-148223');
47+
```
48+
4349
## Pick your framework for some specific setup
4450

4551
* [Laravel/Laravel v5.5](docs/laravel_laravel_v5_5.md)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"require": {
2121
"php": "^7.2",
2222
"monolog/monolog": "^2.0",
23-
"google/cloud": "^0.50"
23+
"google/cloud-logging": "^1.18"
2424
},
2525
"autoload": {
2626
"psr-4": {

docs/laravel_laravel_v5_6.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Add the following entry to the `channels` section in the array below the existin
1313
'driver' => 'custom',
1414
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
1515
'logName' => 'my-project-log',
16-
'loggingClientOptions' => [
17-
'keyFilePath' => '/path/to/service-account-key-file.json',
18-
],
16+
// 'loggingClientOptions' => [
17+
// 'keyFilePath' => '/path/to/service-account-key-file.json',
18+
// ],
1919
// 'loggerOptions' => [],
2020
// 'lineFormat' => '%message%',
2121
// 'entryOptionsWrapper' => 'stackdriver',
@@ -26,6 +26,7 @@ Add the following entry to the `channels` section in the array below the existin
2626
## .env
2727

2828
Edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
29+
And finally add `GOOGLE_APPLICATION_CREDENTIALS` and `GOOGLE_CLOUD_PROJECT` or use loggingClientOptions to set path to key file and project id.
2930

3031
```
3132
LOG_CHANNEL=stackdriver

docs/laravel_laravel_v5_7.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Add the following entry to the `channels` section in the array below the existin
1313
'driver' => 'custom',
1414
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
1515
'logName' => 'my-project-log',
16-
'loggingClientOptions' => [
17-
'keyFilePath' => '/path/to/service-account-key-file.json',
18-
],
16+
// 'loggingClientOptions' => [
17+
// 'keyFilePath' => '/path/to/service-account-key-file.json',
18+
// ],
1919
// 'loggerOptions' => [],
2020
// 'lineFormat' => '%message%',
2121
// 'entryOptionsWrapper' => 'stackdriver',
@@ -26,6 +26,7 @@ Add the following entry to the `channels` section in the array below the existin
2626
## .env
2727

2828
Edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
29+
And finally add `GOOGLE_APPLICATION_CREDENTIALS` and `GOOGLE_CLOUD_PROJECT` or use loggingClientOptions to set path to key file and project id.
2930

3031
```
3132
LOG_CHANNEL=stackdriver

docs/laravel_lumen_v5_6.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Make sure to have a [copy of config/logging.php from the Laravel/Lumen-framework
1717
'driver' => 'custom',
1818
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
1919
'logName' => 'my-project-log',
20-
'loggingClientOptions' => [
21-
'keyFilePath' => '/path/to/service-account-key-file.json',
22-
],
20+
// 'loggingClientOptions' => [
21+
// 'keyFilePath' => '/path/to/service-account-key-file.json',
22+
// ],
2323
// 'loggerOptions' => [],
2424
// 'lineFormat' => '%message%',
2525
// 'entryOptionsWrapper' => 'stackdriver',
@@ -29,7 +29,8 @@ Make sure to have a [copy of config/logging.php from the Laravel/Lumen-framework
2929

3030
## .env
3131

32-
Finally, edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
32+
Edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
33+
And finally add `GOOGLE_APPLICATION_CREDENTIALS` and `GOOGLE_CLOUD_PROJECT` or use loggingClientOptions to set path to key file and project id.
3334

3435
```
3536
LOG_CHANNEL=stackdriver

docs/laravel_lumen_v5_7.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Make sure to have a [copy of config/logging.php from the Laravel/Lumen-framework
1717
'driver' => 'custom',
1818
'via' => CodeInternetApplications\MonologStackdriver\Laravel\CreateStackdriverLogger::class,
1919
'logName' => 'my-project-log',
20-
'loggingClientOptions' => [
21-
'keyFilePath' => '/path/to/service-account-key-file.json',
22-
],
20+
// 'loggingClientOptions' => [
21+
// 'keyFilePath' => '/path/to/service-account-key-file.json',
22+
// ],
2323
// 'loggerOptions' => [],
2424
// 'lineFormat' => '%message%',
2525
// 'entryOptionsWrapper' => 'stackdriver',
@@ -29,7 +29,8 @@ Make sure to have a [copy of config/logging.php from the Laravel/Lumen-framework
2929

3030
## .env
3131

32-
Finally, edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
32+
Edit `.env` to update `LOG_CHANNEL` to `stackdriver`.
33+
And finally add `GOOGLE_APPLICATION_CREDENTIALS` and `GOOGLE_CLOUD_PROJECT` or use loggingClientOptions to set path to key file and project id.
3334

3435
```
3536
LOG_CHANNEL=stackdriver

src/Laravel/CreateStackdriverLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class CreateStackdriverLogger
1515
*/
1616
public function __invoke(array $config)
1717
{
18-
$projectId = $config['logName'] ?? '';
18+
$logName = $config['logName'] ?? '';
1919
$loggingClientOptions = $config['loggingClientOptions'] ?? [];
2020
$loggerOptions = $config['loggerOptions'] ?? [];
2121
$entryOptionsWrapper = $config['entryOptionsWrapper'] ?? 'stackdriver';
2222
$lineFormat = $config['lineFormat'] ?? '%message%';
2323
$level = $config['level'] ?? Logger::DEBUG;
2424
$bubble = $config['bubble'] ?? true;
2525

26-
$stackdriverHandler = new StackdriverHandler($projectId, $loggingClientOptions, $loggerOptions, $entryOptionsWrapper, $lineFormat, $level, $bubble);
26+
$stackdriverHandler = new StackdriverHandler($logName, $loggingClientOptions, $loggerOptions, $entryOptionsWrapper, $lineFormat, $level, $bubble);
2727

2828
$logger = new Logger('stackdriver', [$stackdriverHandler]);
2929

src/StackdriverHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class StackdriverHandler extends AbstractProcessingHandler
4949
* @param int $level The minimum logging level at which this handler will be triggered
5050
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
5151
*/
52-
public function __construct($logName, $loggingClientOptions, $loggerOptions = [], $entryOptionsWrapper = 'stackdriver', $lineFormat = '%message%', $level = Logger::DEBUG, $bubble = true)
52+
public function __construct($logName, $loggingClientOptions = [], $loggerOptions = [], $entryOptionsWrapper = 'stackdriver', $lineFormat = '%message%', $level = Logger::DEBUG, $bubble = true)
5353
{
5454
parent::__construct($level, $bubble);
5555

0 commit comments

Comments
 (0)