WritesLogs::log()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Slides\Connector\Auth\Concerns;
4
5
use Illuminate\Support\Facades\Log;
6
7
/**
8
 * Trait WritesLogs
9
 *
10
 * @package Slides\Connector\Auth\Concerns
11
 */
12
trait WritesLogs
13
{
14
    /**
15
     * The list of parameters that must be hidden.
16
     *
17
     * @var array
18
     */
19
    protected $excludeLoggingParameters = [
20
        'password', 'password_confirmation', 'passwordConfirmation',
21
        'password_confirm', 'passwordConfirm', 'confirmation'
22
    ];
23
24
    /**
25
     * Send a message to logger.
26
     *
27
     * @param string|null $message
28
     * @param array $context
29
     *
30
     * @return void
31
     */
32
    protected function log(?string $message, array $context = [])
33
    {
34
        $securedContext = \Slides\Connector\Auth\Helpers\ArrayHelper::replaceValuesByMatchingKeys(
35
            $context, $this->excludeLoggingParameters, '...'
36
        );
37
38
        Log::debug('[Connector] ' . $message, $securedContext);
39
    }
40
}