1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Logger;
use Monolog\Logger;
class AdyenLogger extends Logger
{
/**
* Detailed debug information
*/
const ADYEN_DEBUG = 101;
const ADYEN_NOTIFICATION = 201;
const ADYEN_RESULT = 202;
const ADYEN_NOTIFICATION_CRONJOB = 203;
/**
* Logging levels from syslog protocol defined in RFC 5424
* Overrule the default to add Adyen specific loggers to log into seperate files
*
* @var array $levels Logging levels
*/
protected static $levels = [
100 => 'DEBUG',
101 => 'ADYEN_DEBUG',
200 => 'INFO',
201 => 'ADYEN_NOTIFICATION',
202 => 'ADYEN_RESULT',
203 => 'ADYEN_NOTIFICATION_CRONJOB',
250 => 'NOTICE',
300 => 'WARNING',
400 => 'ERROR',
500 => 'CRITICAL',
550 => 'ALERT',
600 => 'EMERGENCY',
];
/**
* Adds a log record at the INFO level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function addAdyenNotification($message, array $context = [])
{
return $this->addRecord(static::ADYEN_NOTIFICATION, $message, $context);
}
public function addAdyenDebug($message, array $context = [])
{
return $this->addRecord(static::ADYEN_DEBUG, $message, $context);
}
public function addAdyenResult($message, array $context = [])
{
return $this->addRecord(static::ADYEN_RESULT, $message, $context);
}
public function addAdyenNotificationCronjob($message, array $context = [])
{
return $this->addRecord(static::ADYEN_NOTIFICATION_CRONJOB, $message, $context);
}
/**
* Adds a log record.
*
* @param integer $level The logging level
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function addRecord($level, $message, array $context = [])
{
$context['is_exception'] = $message instanceof \Exception;
return parent::addRecord($level, $message, $context);
}
/**
* Adds a log record at the INFO level.
*
* This method allows for compatibility with common interfaces.
*
* @param string $message The log message
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public function addNotificationLog($message, array $context = [])
{
return $this->addRecord(static::INFO, $message, $context);
}
}