Constant Contact Forms - Version 1.4.1

Version Description

  • Fixed: Issue with generic CSS selector causing other WordPress admin UI to be revealed unintentionally.
  • Fixed: Issue with emails losing submitted information due to newly mismatched md5 hash values for each field.
  • Updated: Re-added outlines styles in a couple of places in admin area for accessibility sake.
  • Updated: Made form ID optional during contact addition method for site owners using plugin for comment/login page signups.
Download this release

Release Info

Developer constantcontact
Plugin Icon 128x128 Constant Contact Forms
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.4.0 to 1.4.1

Files changed (30) hide show
  1. assets/css/admin-style.css +2 -4
  2. assets/sass/_admin-global-no-connection.scss +1 -1
  3. assets/sass/_modal.scss +0 -2
  4. constant-contact-forms.php +2 -2
  5. includes/class-api.php +1 -1
  6. includes/class-connect.php +1 -1
  7. includes/class-display.php +3 -1
  8. readme.txt +8 -18
  9. vendor/CMB2/languages/cmb2-pt_PT.mo.orig +0 -0
  10. vendor/constantcontact/constantcontact/.gitignore +0 -25
  11. vendor/constantcontact/constantcontact/.travis.yml +0 -20
  12. vendor/monolog/monolog/CHANGELOG.md +0 -342
  13. vendor/monolog/monolog/README.md +0 -95
  14. vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php +0 -84
  15. vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php +0 -387
  16. vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php +0 -107
  17. vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php +0 -47
  18. vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php +0 -41
  19. vendor/monolog/monolog/vendor/psr/log/LICENSE +19 -0
  20. vendor/monolog/monolog/vendor/psr/log/Psr/Log/AbstractLogger.php +128 -0
  21. vendor/monolog/monolog/vendor/psr/log/Psr/Log/InvalidArgumentException.php +7 -0
  22. vendor/monolog/monolog/vendor/psr/log/Psr/Log/LogLevel.php +18 -0
  23. vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +18 -0
  24. vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +26 -0
  25. vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerInterface.php +123 -0
  26. vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerTrait.php +140 -0
  27. vendor/monolog/monolog/vendor/psr/log/Psr/Log/NullLogger.php +28 -0
  28. vendor/monolog/monolog/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +140 -0
  29. vendor/monolog/monolog/vendor/psr/log/README.md +45 -0
  30. vendor/monolog/monolog/vendor/psr/log/composer.json +26 -0
assets/css/admin-style.css CHANGED
@@ -75,7 +75,6 @@
75
  background-color: #ffffff;
76
  border-radius: 8px;
77
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
78
- outline: 0;
79
  padding: rem(10);
80
  position: relative;
81
  }
@@ -109,7 +108,6 @@
109
  height: 16px;
110
  line-height: 0;
111
  margin: 0;
112
- outline: none;
113
  padding: 0;
114
  padding: 0;
115
  position: absolute;
@@ -804,7 +802,7 @@ body.post-type-ctct_forms #titlediv #title {
804
  }
805
  }
806
 
807
- .error {
808
  background: none !important;
809
  border-left: 1px solid #FF4136 !important;
810
  border-radius: 3px;
@@ -814,7 +812,7 @@ body.post-type-ctct_forms #titlediv #title {
814
  margin: 0 0 20px 0 !important;
815
  }
816
 
817
- .error p {
818
  color: #FF4136 !important;
819
  }
820
 
75
  background-color: #ffffff;
76
  border-radius: 8px;
77
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
 
78
  padding: rem(10);
79
  position: relative;
80
  }
108
  height: 16px;
109
  line-height: 0;
110
  margin: 0;
 
111
  padding: 0;
112
  padding: 0;
113
  position: absolute;
802
  }
803
  }
804
 
805
+ .ctct-error {
806
  background: none !important;
807
  border-left: 1px solid #FF4136 !important;
808
  border-radius: 3px;
812
  margin: 0 0 20px 0 !important;
813
  }
814
 
815
+ .ctct-error p {
816
  color: #FF4136 !important;
817
  }
818
 
assets/sass/_admin-global-no-connection.scss CHANGED
@@ -275,7 +275,7 @@
275
 
276
  // ctct_options_connect
277
 
278
- .error {
279
  background: none !important;
280
  border-left: 1px solid $color-red !important;
281
  border-radius: 3px;
275
 
276
  // ctct_options_connect
277
 
278
+ .ctct-error {
279
  background: none !important;
280
  border-left: 1px solid $color-red !important;
281
  border-radius: 3px;
assets/sass/_modal.scss CHANGED
@@ -74,7 +74,6 @@
74
  background-color: #ffffff;
75
  border-radius: 8px;
76
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
77
- outline: 0;
78
  padding: rem(10);
79
  position: relative;
80
 
@@ -112,7 +111,6 @@
112
  height: 16px;
113
  line-height: 0;
114
  margin: 0;
115
- outline: none;
116
  padding: 0;
117
  padding: 0;
118
  position: absolute;
74
  background-color: #ffffff;
75
  border-radius: 8px;
76
  box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.4);
 
77
  padding: rem(10);
78
  position: relative;
79
 
111
  height: 16px;
112
  line-height: 0;
113
  margin: 0;
 
114
  padding: 0;
115
  padding: 0;
116
  position: absolute;
constant-contact-forms.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Constant Contact Forms for WordPress
13
  * Plugin URI: https://www.constantcontact.com
14
  * Description: Be a better marketer. All it takes is Constant Contact email marketing.
15
- * Version: 1.4.0
16
  * Author: Constant Contact
17
  * Author URI: https://www.constantcontact.com/index?pn=miwordpress
18
  * License: GPLv3
@@ -77,7 +77,7 @@ class Constant_Contact {
77
  * @since 1.0.0
78
  * @var string
79
  */
80
- const VERSION = '1.4.0';
81
 
82
  /**
83
  * URL of plugin directory.
12
  * Plugin Name: Constant Contact Forms for WordPress
13
  * Plugin URI: https://www.constantcontact.com
14
  * Description: Be a better marketer. All it takes is Constant Contact email marketing.
15
+ * Version: 1.4.1
16
  * Author: Constant Contact
17
  * Author URI: https://www.constantcontact.com/index?pn=miwordpress
18
  * License: GPLv3
77
  * @since 1.0.0
78
  * @var string
79
  */
80
+ const VERSION = '1.4.1';
81
 
82
  /**
83
  * URL of plugin directory.
includes/class-api.php CHANGED
@@ -391,7 +391,7 @@ class ConstantContact_API {
391
  * @param string $form_id ID of the form being processed.
392
  * @return array Current connect ctct lists.
393
  */
394
- public function add_contact( $new_contact = array(), $form_id ) {
395
 
396
  // Make sure we're passed a full set of data.
397
  if ( empty( $new_contact ) ) {
391
  * @param string $form_id ID of the form being processed.
392
  * @return array Current connect ctct lists.
393
  */
394
+ public function add_contact( $new_contact = array(), $form_id = 0 ) {
395
 
396
  // Make sure we're passed a full set of data.
397
  if ( empty( $new_contact ) ) {
includes/class-connect.php CHANGED
@@ -215,7 +215,7 @@ class ConstantContact_Connect {
215
  <?php
216
  if ( isset( $_GET['ctct_connect_error'] ) ) { // Input var okay.
217
  ?>
218
- <div id="message" class="error"><p>
219
  <?php esc_html_e( 'There was an error connecting your account. Please try again.', 'constant-contact-forms' ); ?>
220
  </p></div>
221
  <?php
215
  <?php
216
  if ( isset( $_GET['ctct_connect_error'] ) ) { // Input var okay.
217
  ?>
218
+ <div id="message" class="ctct-error"><p>
219
  <?php esc_html_e( 'There was an error connecting your account. Please try again.', 'constant-contact-forms' ); ?>
220
  </p></div>
221
  <?php
includes/class-display.php CHANGED
@@ -591,7 +591,9 @@ class ConstantContact_Display {
591
  // We may have more than one of the same field in our array.
592
  // this makes sure we keep them unique when processing them.
593
  if ( 'submit' !== $type ) {
594
- $map = $map . '___' . md5( serialize( $field ) );
 
 
595
  }
596
 
597
  // Default error status.
591
  // We may have more than one of the same field in our array.
592
  // this makes sure we keep them unique when processing them.
593
  if ( 'submit' !== $type ) {
594
+ $temp_field = $field;
595
+ unset( $temp_field['field_custom_css'] );
596
+ $map = $map . '___' . md5( serialize( $temp_field ) );
597
  }
598
 
599
  // Default error status.
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: constantcontact
3
  Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
4
  Requires at least: 4.0.0
5
- Tested up to: 4.9.7
6
- Stable tag: 1.4.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
  Requires PHP: 5.4
@@ -35,6 +35,12 @@ BONUS: If you have a Constant Contact account, all new email addresses that you
35
 
36
  == Changelog ==
37
 
 
 
 
 
 
 
38
  = 1.4.0 =
39
  * Added: Various styling options during the form building process.
40
  * Added: Initial Akismet integration to help aid with spam submissions.
@@ -190,22 +196,6 @@ BONUS: If you have a Constant Contact account, all new email addresses that you
190
  * Fixed: Removed required attribute for Address line 2 when line 1 is required.
191
  * Updated: Labels in Constant Contact Form list around none available and none in trash.
192
 
193
- = 1.0.3 =
194
- * Fixed: Improperly placed content for Constant Contact API requests for phone and website fields.
195
- * Updated: Default text for admin email subject line and email footer copy.
196
-
197
- = 1.0.2 =
198
- * Update copyright information.
199
- * Remove Form Options for users who aren't connected to Constant Contact.
200
- * Clean up API fields.
201
-
202
- = 1.0.1 =
203
- * Fixed: issue with PHP 5.5+ syntax when we need 5.4+
204
- * Added: Prevention of plugin loading for users below PHP version 5.4 to avoid incompatibility issues.
205
-
206
- = 1.0.0 =
207
- * Initial Release
208
-
209
  == Frequently Asked Questions ==
210
 
211
  #### Constant Contact Forms Options
2
  Contributors: constantcontact
3
  Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
4
  Requires at least: 4.0.0
5
+ Tested up to: 4.9.8
6
+ Stable tag: 1.4.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
  Requires PHP: 5.4
35
 
36
  == Changelog ==
37
 
38
+ = 1.4.1 =
39
+ * Fixed: Issue with generic CSS selector causing other WordPress admin UI to be revealed unintentionally.
40
+ * Fixed: Issue with emails losing submitted information due to newly mismatched md5 hash values for each field.
41
+ * Updated: Re-added outlines styles in a couple of places in admin area for accessibility sake.
42
+ * Updated: Made form ID optional during contact addition method for site owners using plugin for comment/login page signups.
43
+
44
  = 1.4.0 =
45
  * Added: Various styling options during the form building process.
46
  * Added: Initial Akismet integration to help aid with spam submissions.
196
  * Fixed: Removed required attribute for Address line 2 when line 1 is required.
197
  * Updated: Labels in Constant Contact Form list around none available and none in trash.
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  == Frequently Asked Questions ==
200
 
201
  #### Constant Contact Forms Options
vendor/CMB2/languages/cmb2-pt_PT.mo.orig DELETED
Binary file
vendor/constantcontact/constantcontact/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- # Created by .gitignore support plugin (hsz.mobi)
2
-
3
- ## Directory-based project format
4
- .idea/
5
- /*.iml
6
-
7
- ## File-based project format
8
- *.ipr
9
- *.iws
10
-
11
- ## Additional for IntelliJ
12
- out/
13
-
14
- # generated by mpeltonen/sbt-idea plugin
15
- .idea_modules/
16
-
17
- # generated by JIRA plugin
18
- atlassian-ide-plugin.xml
19
-
20
- ### Composer template
21
- composer.lock
22
- composer.phar
23
- vendor/
24
-
25
- devFile.php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/constantcontact/constantcontact/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: php
2
-
3
- php:
4
- - 5.4
5
- - 5.5
6
- - 5.6
7
- - hhvm
8
-
9
- env:
10
- - GUZZLE_VERSION="5.1.0"
11
-
12
- before_script: composer install
13
-
14
- install:
15
- - composer require guzzlehttp/guzzle:${GUZZLE_VERSION}
16
-
17
- matrix:
18
- allow_failures:
19
- - php: hhvm
20
- fast_finish: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/CHANGELOG.md DELETED
@@ -1,342 +0,0 @@
1
- ### 1.23.0 (2017-06-19)
2
-
3
- * Improved SyslogUdpHandler's support for RFC5424 and added optional `$ident` argument
4
- * Fixed GelfHandler truncation to be per field and not per message
5
- * Fixed compatibility issue with PHP <5.3.6
6
- * Fixed support for headless Chrome in ChromePHPHandler
7
- * Fixed support for latest Aws SDK in DynamoDbHandler
8
- * Fixed support for SwiftMailer 6.0+ in SwiftMailerHandler
9
-
10
- ### 1.22.1 (2017-03-13)
11
-
12
- * Fixed lots of minor issues in the new Slack integrations
13
- * Fixed support for allowInlineLineBreaks in LineFormatter when formatting exception backtraces
14
-
15
- ### 1.22.0 (2016-11-26)
16
-
17
- * Added SlackbotHandler and SlackWebhookHandler to set up Slack integration more easily
18
- * Added MercurialProcessor to add mercurial revision and branch names to log records
19
- * Added support for AWS SDK v3 in DynamoDbHandler
20
- * Fixed fatal errors occuring when normalizing generators that have been fully consumed
21
- * Fixed RollbarHandler to include a level (rollbar level), monolog_level (original name), channel and datetime (unix)
22
- * Fixed RollbarHandler not flushing records automatically, calling close() explicitly is not necessary anymore
23
- * Fixed SyslogUdpHandler to avoid sending empty frames
24
- * Fixed a few PHP 7.0 and 7.1 compatibility issues
25
-
26
- ### 1.21.0 (2016-07-29)
27
-
28
- * Break: Reverted the addition of $context when the ErrorHandler handles regular php errors from 1.20.0 as it was causing issues
29
- * Added support for more formats in RotatingFileHandler::setFilenameFormat as long as they have Y, m and d in order
30
- * Added ability to format the main line of text the SlackHandler sends by explictly setting a formatter on the handler
31
- * Added information about SoapFault instances in NormalizerFormatter
32
- * Added $handleOnlyReportedErrors option on ErrorHandler::registerErrorHandler (default true) to allow logging of all errors no matter the error_reporting level
33
-
34
- ### 1.20.0 (2016-07-02)
35
-
36
- * Added FingersCrossedHandler::activate() to manually trigger the handler regardless of the activation policy
37
- * Added StreamHandler::getUrl to retrieve the stream's URL
38
- * Added ability to override addRow/addTitle in HtmlFormatter
39
- * Added the $context to context information when the ErrorHandler handles a regular php error
40
- * Deprecated RotatingFileHandler::setFilenameFormat to only support 3 formats: Y, Y-m and Y-m-d
41
- * Fixed WhatFailureGroupHandler to work with PHP7 throwables
42
- * Fixed a few minor bugs
43
-
44
- ### 1.19.0 (2016-04-12)
45
-
46
- * Break: StreamHandler will not close streams automatically that it does not own. If you pass in a stream (not a path/url), then it will not close it for you. You can retrieve those using getStream() if needed
47
- * Added DeduplicationHandler to remove duplicate records from notifications across multiple requests, useful for email or other notifications on errors
48
- * Added ability to use `%message%` and other LineFormatter replacements in the subject line of emails sent with NativeMailHandler and SwiftMailerHandler
49
- * Fixed HipChatHandler handling of long messages
50
-
51
- ### 1.18.2 (2016-04-02)
52
-
53
- * Fixed ElasticaFormatter to use more precise dates
54
- * Fixed GelfMessageFormatter sending too long messages
55
-
56
- ### 1.18.1 (2016-03-13)
57
-
58
- * Fixed SlackHandler bug where slack dropped messages randomly
59
- * Fixed RedisHandler issue when using with the PHPRedis extension
60
- * Fixed AmqpHandler content-type being incorrectly set when using with the AMQP extension
61
- * Fixed BrowserConsoleHandler regression
62
-
63
- ### 1.18.0 (2016-03-01)
64
-
65
- * Added optional reduction of timestamp precision via `Logger->useMicrosecondTimestamps(false)`, disabling it gets you a bit of performance boost but reduces the precision to the second instead of microsecond
66
- * Added possibility to skip some extra stack frames in IntrospectionProcessor if you have some library wrapping Monolog that is always adding frames
67
- * Added `Logger->withName` to clone a logger (keeping all handlers) with a new name
68
- * Added FluentdFormatter for the Fluentd unix socket protocol
69
- * Added HandlerWrapper base class to ease the creation of handler wrappers, just extend it and override as needed
70
- * Added support for replacing context sub-keys using `%context.*%` in LineFormatter
71
- * Added support for `payload` context value in RollbarHandler
72
- * Added setRelease to RavenHandler to describe the application version, sent with every log
73
- * Added support for `fingerprint` context value in RavenHandler
74
- * Fixed JSON encoding errors that would gobble up the whole log record, we now handle those more gracefully by dropping chars as needed
75
- * Fixed write timeouts in SocketHandler and derivatives, set to 10sec by default, lower it with `setWritingTimeout()`
76
- * Fixed PHP7 compatibility with regard to Exception/Throwable handling in a few places
77
-
78
- ### 1.17.2 (2015-10-14)
79
-
80
- * Fixed ErrorHandler compatibility with non-Monolog PSR-3 loggers
81
- * Fixed SlackHandler handling to use slack functionalities better
82
- * Fixed SwiftMailerHandler bug when sending multiple emails they all had the same id
83
- * Fixed 5.3 compatibility regression
84
-
85
- ### 1.17.1 (2015-08-31)
86
-
87
- * Fixed RollbarHandler triggering PHP notices
88
-
89
- ### 1.17.0 (2015-08-30)
90
-
91
- * Added support for `checksum` and `release` context/extra values in RavenHandler
92
- * Added better support for exceptions in RollbarHandler
93
- * Added UidProcessor::getUid
94
- * Added support for showing the resource type in NormalizedFormatter
95
- * Fixed IntrospectionProcessor triggering PHP notices
96
-
97
- ### 1.16.0 (2015-08-09)
98
-
99
- * Added IFTTTHandler to notify ifttt.com triggers
100
- * Added Logger::setHandlers() to allow setting/replacing all handlers
101
- * Added $capSize in RedisHandler to cap the log size
102
- * Fixed StreamHandler creation of directory to only trigger when the first log write happens
103
- * Fixed bug in the handling of curl failures
104
- * Fixed duplicate logging of fatal errors when both error and fatal error handlers are registered in monolog's ErrorHandler
105
- * Fixed missing fatal errors records with handlers that need to be closed to flush log records
106
- * Fixed TagProcessor::addTags support for associative arrays
107
-
108
- ### 1.15.0 (2015-07-12)
109
-
110
- * Added addTags and setTags methods to change a TagProcessor
111
- * Added automatic creation of directories if they are missing for a StreamHandler to open a log file
112
- * Added retry functionality to Loggly, Cube and Mandrill handlers so they retry up to 5 times in case of network failure
113
- * Fixed process exit code being incorrectly reset to 0 if ErrorHandler::registerExceptionHandler was used
114
- * Fixed HTML/JS escaping in BrowserConsoleHandler
115
- * Fixed JSON encoding errors being silently suppressed (PHP 5.5+ only)
116
-
117
- ### 1.14.0 (2015-06-19)
118
-
119
- * Added PHPConsoleHandler to send record to Chrome's PHP Console extension and library
120
- * Added support for objects implementing __toString in the NormalizerFormatter
121
- * Added support for HipChat's v2 API in HipChatHandler
122
- * Added Logger::setTimezone() to initialize the timezone monolog should use in case date.timezone isn't correct for your app
123
- * Added an option to send formatted message instead of the raw record on PushoverHandler via ->useFormattedMessage(true)
124
- * Fixed curl errors being silently suppressed
125
-
126
- ### 1.13.1 (2015-03-09)
127
-
128
- * Fixed regression in HipChat requiring a new token to be created
129
-
130
- ### 1.13.0 (2015-03-05)
131
-
132
- * Added Registry::hasLogger to check for the presence of a logger instance
133
- * Added context.user support to RavenHandler
134
- * Added HipChat API v2 support in the HipChatHandler
135
- * Added NativeMailerHandler::addParameter to pass params to the mail() process
136
- * Added context data to SlackHandler when $includeContextAndExtra is true
137
- * Added ability to customize the Swift_Message per-email in SwiftMailerHandler
138
- * Fixed SwiftMailerHandler to lazily create message instances if a callback is provided
139
- * Fixed serialization of INF and NaN values in Normalizer and LineFormatter
140
-
141
- ### 1.12.0 (2014-12-29)
142
-
143
- * Break: HandlerInterface::isHandling now receives a partial record containing only a level key. This was always the intent and does not break any Monolog handler but is strictly speaking a BC break and you should check if you relied on any other field in your own handlers.
144
- * Added PsrHandler to forward records to another PSR-3 logger
145
- * Added SamplingHandler to wrap around a handler and include only every Nth record
146
- * Added MongoDBFormatter to support better storage with MongoDBHandler (it must be enabled manually for now)
147
- * Added exception codes in the output of most formatters
148
- * Added LineFormatter::includeStacktraces to enable exception stack traces in logs (uses more than one line)
149
- * Added $useShortAttachment to SlackHandler to minify attachment size and $includeExtra to append extra data
150
- * Added $host to HipChatHandler for users of private instances
151
- * Added $transactionName to NewRelicHandler and support for a transaction_name context value
152
- * Fixed MandrillHandler to avoid outputing API call responses
153
- * Fixed some non-standard behaviors in SyslogUdpHandler
154
-
155
- ### 1.11.0 (2014-09-30)
156
-
157
- * Break: The NewRelicHandler extra and context data are now prefixed with extra_ and context_ to avoid clashes. Watch out if you have scripts reading those from the API and rely on names
158
- * Added WhatFailureGroupHandler to suppress any exception coming from the wrapped handlers and avoid chain failures if a logging service fails
159
- * Added MandrillHandler to send emails via the Mandrillapp.com API
160
- * Added SlackHandler to log records to a Slack.com account
161
- * Added FleepHookHandler to log records to a Fleep.io account
162
- * Added LogglyHandler::addTag to allow adding tags to an existing handler
163
- * Added $ignoreEmptyContextAndExtra to LineFormatter to avoid empty [] at the end
164
- * Added $useLocking to StreamHandler and RotatingFileHandler to enable flock() while writing
165
- * Added support for PhpAmqpLib in the AmqpHandler
166
- * Added FingersCrossedHandler::clear and BufferHandler::clear to reset them between batches in long running jobs
167
- * Added support for adding extra fields from $_SERVER in the WebProcessor
168
- * Fixed support for non-string values in PrsLogMessageProcessor
169
- * Fixed SwiftMailer messages being sent with the wrong date in long running scripts
170
- * Fixed minor PHP 5.6 compatibility issues
171
- * Fixed BufferHandler::close being called twice
172
-
173
- ### 1.10.0 (2014-06-04)
174
-
175
- * Added Logger::getHandlers() and Logger::getProcessors() methods
176
- * Added $passthruLevel argument to FingersCrossedHandler to let it always pass some records through even if the trigger level is not reached
177
- * Added support for extra data in NewRelicHandler
178
- * Added $expandNewlines flag to the ErrorLogHandler to create multiple log entries when a message has multiple lines
179
-
180
- ### 1.9.1 (2014-04-24)
181
-
182
- * Fixed regression in RotatingFileHandler file permissions
183
- * Fixed initialization of the BufferHandler to make sure it gets flushed after receiving records
184
- * Fixed ChromePHPHandler and FirePHPHandler's activation strategies to be more conservative
185
-
186
- ### 1.9.0 (2014-04-20)
187
-
188
- * Added LogEntriesHandler to send logs to a LogEntries account
189
- * Added $filePermissions to tweak file mode on StreamHandler and RotatingFileHandler
190
- * Added $useFormatting flag to MemoryProcessor to make it send raw data in bytes
191
- * Added support for table formatting in FirePHPHandler via the table context key
192
- * Added a TagProcessor to add tags to records, and support for tags in RavenHandler
193
- * Added $appendNewline flag to the JsonFormatter to enable using it when logging to files
194
- * Added sound support to the PushoverHandler
195
- * Fixed multi-threading support in StreamHandler
196
- * Fixed empty headers issue when ChromePHPHandler received no records
197
- * Fixed default format of the ErrorLogHandler
198
-
199
- ### 1.8.0 (2014-03-23)
200
-
201
- * Break: the LineFormatter now strips newlines by default because this was a bug, set $allowInlineLineBreaks to true if you need them
202
- * Added BrowserConsoleHandler to send logs to any browser's console via console.log() injection in the output
203
- * Added FilterHandler to filter records and only allow those of a given list of levels through to the wrapped handler
204
- * Added FlowdockHandler to send logs to a Flowdock account
205
- * Added RollbarHandler to send logs to a Rollbar account
206
- * Added HtmlFormatter to send prettier log emails with colors for each log level
207
- * Added GitProcessor to add the current branch/commit to extra record data
208
- * Added a Monolog\Registry class to allow easier global access to pre-configured loggers
209
- * Added support for the new official graylog2/gelf-php lib for GelfHandler, upgrade if you can by replacing the mlehner/gelf-php requirement
210
- * Added support for HHVM
211
- * Added support for Loggly batch uploads
212
- * Added support for tweaking the content type and encoding in NativeMailerHandler
213
- * Added $skipClassesPartials to tweak the ignored classes in the IntrospectionProcessor
214
- * Fixed batch request support in GelfHandler
215
-
216
- ### 1.7.0 (2013-11-14)
217
-
218
- * Added ElasticSearchHandler to send logs to an Elastic Search server
219
- * Added DynamoDbHandler and ScalarFormatter to send logs to Amazon's Dynamo DB
220
- * Added SyslogUdpHandler to send logs to a remote syslogd server
221
- * Added LogglyHandler to send logs to a Loggly account
222
- * Added $level to IntrospectionProcessor so it only adds backtraces when needed
223
- * Added $version to LogstashFormatter to allow using the new v1 Logstash format
224
- * Added $appName to NewRelicHandler
225
- * Added configuration of Pushover notification retries/expiry
226
- * Added $maxColumnWidth to NativeMailerHandler to change the 70 chars default
227
- * Added chainability to most setters for all handlers
228
- * Fixed RavenHandler batch processing so it takes the message from the record with highest priority
229
- * Fixed HipChatHandler batch processing so it sends all messages at once
230
- * Fixed issues with eAccelerator
231
- * Fixed and improved many small things
232
-
233
- ### 1.6.0 (2013-07-29)
234
-
235
- * Added HipChatHandler to send logs to a HipChat chat room
236
- * Added ErrorLogHandler to send logs to PHP's error_log function
237
- * Added NewRelicHandler to send logs to NewRelic's service
238
- * Added Monolog\ErrorHandler helper class to register a Logger as exception/error/fatal handler
239
- * Added ChannelLevelActivationStrategy for the FingersCrossedHandler to customize levels by channel
240
- * Added stack traces output when normalizing exceptions (json output & co)
241
- * Added Monolog\Logger::API constant (currently 1)
242
- * Added support for ChromePHP's v4.0 extension
243
- * Added support for message priorities in PushoverHandler, see $highPriorityLevel and $emergencyLevel
244
- * Added support for sending messages to multiple users at once with the PushoverHandler
245
- * Fixed RavenHandler's support for batch sending of messages (when behind a Buffer or FingersCrossedHandler)
246
- * Fixed normalization of Traversables with very large data sets, only the first 1000 items are shown now
247
- * Fixed issue in RotatingFileHandler when an open_basedir restriction is active
248
- * Fixed minor issues in RavenHandler and bumped the API to Raven 0.5.0
249
- * Fixed SyslogHandler issue when many were used concurrently with different facilities
250
-
251
- ### 1.5.0 (2013-04-23)
252
-
253
- * Added ProcessIdProcessor to inject the PID in log records
254
- * Added UidProcessor to inject a unique identifier to all log records of one request/run
255
- * Added support for previous exceptions in the LineFormatter exception serialization
256
- * Added Monolog\Logger::getLevels() to get all available levels
257
- * Fixed ChromePHPHandler so it avoids sending headers larger than Chrome can handle
258
-
259
- ### 1.4.1 (2013-04-01)
260
-
261
- * Fixed exception formatting in the LineFormatter to be more minimalistic
262
- * Fixed RavenHandler's handling of context/extra data, requires Raven client >0.1.0
263
- * Fixed log rotation in RotatingFileHandler to work with long running scripts spanning multiple days
264
- * Fixed WebProcessor array access so it checks for data presence
265
- * Fixed Buffer, Group and FingersCrossed handlers to make use of their processors
266
-
267
- ### 1.4.0 (2013-02-13)
268
-
269
- * Added RedisHandler to log to Redis via the Predis library or the phpredis extension
270
- * Added ZendMonitorHandler to log to the Zend Server monitor
271
- * Added the possibility to pass arrays of handlers and processors directly in the Logger constructor
272
- * Added `$useSSL` option to the PushoverHandler which is enabled by default
273
- * Fixed ChromePHPHandler and FirePHPHandler issue when multiple instances are used simultaneously
274
- * Fixed header injection capability in the NativeMailHandler
275
-
276
- ### 1.3.1 (2013-01-11)
277
-
278
- * Fixed LogstashFormatter to be usable with stream handlers
279
- * Fixed GelfMessageFormatter levels on Windows
280
-
281
- ### 1.3.0 (2013-01-08)
282
-
283
- * Added PSR-3 compliance, the `Monolog\Logger` class is now an instance of `Psr\Log\LoggerInterface`
284
- * Added PsrLogMessageProcessor that you can selectively enable for full PSR-3 compliance
285
- * Added LogstashFormatter (combine with SocketHandler or StreamHandler to send logs to Logstash)
286
- * Added PushoverHandler to send mobile notifications
287
- * Added CouchDBHandler and DoctrineCouchDBHandler
288
- * Added RavenHandler to send data to Sentry servers
289
- * Added support for the new MongoClient class in MongoDBHandler
290
- * Added microsecond precision to log records' timestamps
291
- * Added `$flushOnOverflow` param to BufferHandler to flush by batches instead of losing
292
- the oldest entries
293
- * Fixed normalization of objects with cyclic references
294
-
295
- ### 1.2.1 (2012-08-29)
296
-
297
- * Added new $logopts arg to SyslogHandler to provide custom openlog options
298
- * Fixed fatal error in SyslogHandler
299
-
300
- ### 1.2.0 (2012-08-18)
301
-
302
- * Added AmqpHandler (for use with AMQP servers)
303
- * Added CubeHandler
304
- * Added NativeMailerHandler::addHeader() to send custom headers in mails
305
- * Added the possibility to specify more than one recipient in NativeMailerHandler
306
- * Added the possibility to specify float timeouts in SocketHandler
307
- * Added NOTICE and EMERGENCY levels to conform with RFC 5424
308
- * Fixed the log records to use the php default timezone instead of UTC
309
- * Fixed BufferHandler not being flushed properly on PHP fatal errors
310
- * Fixed normalization of exotic resource types
311
- * Fixed the default format of the SyslogHandler to avoid duplicating datetimes in syslog
312
-
313
- ### 1.1.0 (2012-04-23)
314
-
315
- * Added Monolog\Logger::isHandling() to check if a handler will
316
- handle the given log level
317
- * Added ChromePHPHandler
318
- * Added MongoDBHandler
319
- * Added GelfHandler (for use with Graylog2 servers)
320
- * Added SocketHandler (for use with syslog-ng for example)
321
- * Added NormalizerFormatter
322
- * Added the possibility to change the activation strategy of the FingersCrossedHandler
323
- * Added possibility to show microseconds in logs
324
- * Added `server` and `referer` to WebProcessor output
325
-
326
- ### 1.0.2 (2011-10-24)
327
-
328
- * Fixed bug in IE with large response headers and FirePHPHandler
329
-
330
- ### 1.0.1 (2011-08-25)
331
-
332
- * Added MemoryPeakUsageProcessor and MemoryUsageProcessor
333
- * Added Monolog\Logger::getName() to get a logger's channel name
334
-
335
- ### 1.0.0 (2011-07-06)
336
-
337
- * Added IntrospectionProcessor to get info from where the logger was called
338
- * Fixed WebProcessor in CLI
339
-
340
- ### 1.0.0-RC1 (2011-07-01)
341
-
342
- * Initial release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/README.md DELETED
@@ -1,95 +0,0 @@
1
- # Monolog - Logging for PHP [![Build Status](https://img.shields.io/travis/Seldaek/monolog.svg)](https://travis-ci.org/Seldaek/monolog)
2
-
3
- [![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
4
- [![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
5
- [![Reference Status](https://www.versioneye.com/php/monolog:monolog/reference_badge.svg)](https://www.versioneye.com/php/monolog:monolog/references)
6
-
7
-
8
- Monolog sends your logs to files, sockets, inboxes, databases and various
9
- web services. See the complete list of handlers below. Special handlers
10
- allow you to build advanced logging strategies.
11
-
12
- This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
13
- interface that you can type-hint against in your own libraries to keep
14
- a maximum of interoperability. You can also use it in your applications to
15
- make sure you can always use another compatible logger at a later time.
16
- As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
17
- Internally Monolog still uses its own level scheme since it predates PSR-3.
18
-
19
- ## Installation
20
-
21
- Install the latest version with
22
-
23
- ```bash
24
- $ composer require monolog/monolog
25
- ```
26
-
27
- ## Basic Usage
28
-
29
- ```php
30
- <?php
31
-
32
- use Monolog\Logger;
33
- use Monolog\Handler\StreamHandler;
34
-
35
- // create a log channel
36
- $log = new Logger('name');
37
- $log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
38
-
39
- // add records to the log
40
- $log->addWarning('Foo');
41
- $log->addError('Bar');
42
- ```
43
-
44
- ## Documentation
45
-
46
- - [Usage Instructions](doc/01-usage.md)
47
- - [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md)
48
- - [Utility classes](doc/03-utilities.md)
49
- - [Extending Monolog](doc/04-extending.md)
50
-
51
- ## Third Party Packages
52
-
53
- Third party handlers, formatters and processors are
54
- [listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
55
- can also add your own there if you publish one.
56
-
57
- ## About
58
-
59
- ### Requirements
60
-
61
- - Monolog works with PHP 5.3 or above, and is also tested to work with HHVM.
62
-
63
- ### Submitting bugs and feature requests
64
-
65
- Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
66
-
67
- ### Framework Integrations
68
-
69
- - Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
70
- can be used very easily with Monolog since it implements the interface.
71
- - [Symfony2](http://symfony.com) comes out of the box with Monolog.
72
- - [Silex](http://silex.sensiolabs.org/) comes out of the box with Monolog.
73
- - [Laravel 4 & 5](http://laravel.com/) come out of the box with Monolog.
74
- - [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog.
75
- - [PPI](http://www.ppi.io/) comes out of the box with Monolog.
76
- - [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin.
77
- - [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer.
78
- - [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog.
79
- - [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog.
80
- - [Nette Framework](http://nette.org/en/) can be used with Monolog via [Kdyby/Monolog](https://github.com/Kdyby/Monolog) extension.
81
- - [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog.
82
-
83
- ### Author
84
-
85
- Jordi Boggiano - <j.boggiano@seld.be> - <http://twitter.com/seldaek><br />
86
- See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) which participated in this project.
87
-
88
- ### License
89
-
90
- Monolog is licensed under the MIT License - see the `LICENSE` file for details
91
-
92
- ### Acknowledgements
93
-
94
- This library is heavily inspired by Python's [Logbook](http://packages.python.org/Logbook/)
95
- library, although most concepts have been adjusted to fit to the PHP world.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/tests/Monolog/Handler/RollbarHandlerTest.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Monolog package.
5
- *
6
- * (c) Jordi Boggiano <j.boggiano@seld.be>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Monolog\Handler;
13
-
14
- use Exception;
15
- use Monolog\TestCase;
16
- use Monolog\Logger;
17
- use PHPUnit_Framework_MockObject_MockObject as MockObject;
18
-
19
- /**
20
- * @author Erik Johansson <erik.pm.johansson@gmail.com>
21
- * @see https://rollbar.com/docs/notifier/rollbar-php/
22
- *
23
- * @coversDefaultClass Monolog\Handler\RollbarHandler
24
- */
25
- class RollbarHandlerTest extends TestCase
26
- {
27
- /**
28
- * @var MockObject
29
- */
30
- private $rollbarNotifier;
31
-
32
- /**
33
- * @var array
34
- */
35
- public $reportedExceptionArguments = null;
36
-
37
- protected function setUp()
38
- {
39
- parent::setUp();
40
-
41
- $this->setupRollbarNotifierMock();
42
- }
43
-
44
- /**
45
- * When reporting exceptions to Rollbar the
46
- * level has to be set in the payload data
47
- */
48
- public function testExceptionLogLevel()
49
- {
50
- $handler = $this->createHandler();
51
-
52
- $handler->handle($this->createExceptionRecord(Logger::DEBUG));
53
-
54
- $this->assertEquals('debug', $this->reportedExceptionArguments['payload']['level']);
55
- }
56
-
57
- private function setupRollbarNotifierMock()
58
- {
59
- $this->rollbarNotifier = $this->getMockBuilder('RollbarNotifier')
60
- ->setMethods(array('report_message', 'report_exception', 'flush'))
61
- ->getMock();
62
-
63
- $that = $this;
64
-
65
- $this->rollbarNotifier
66
- ->expects($this->any())
67
- ->method('report_exception')
68
- ->willReturnCallback(function ($exception, $context, $payload) use ($that) {
69
- $that->reportedExceptionArguments = compact('exception', 'context', 'payload');
70
- });
71
- }
72
-
73
- private function createHandler()
74
- {
75
- return new RollbarHandler($this->rollbarNotifier, Logger::DEBUG);
76
- }
77
-
78
- private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null)
79
- {
80
- return $this->getRecord($level, $message, array(
81
- 'exception' => $exception ?: new Exception()
82
- ));
83
- }
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/tests/Monolog/Handler/Slack/SlackRecordTest.php DELETED
@@ -1,387 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Monolog package.
5
- *
6
- * (c) Jordi Boggiano <j.boggiano@seld.be>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Monolog\Handler\Slack;
13
-
14
- use Monolog\Logger;
15
- use Monolog\TestCase;
16
-
17
- /**
18
- * @coversDefaultClass Monolog\Handler\Slack\SlackRecord
19
- */
20
- class SlackRecordTest extends TestCase
21
- {
22
- private $jsonPrettyPrintFlag;
23
-
24
- protected function setUp()
25
- {
26
- $this->jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
27
- }
28
-
29
- public function dataGetAttachmentColor()
30
- {
31
- return array(
32
- array(Logger::DEBUG, SlackRecord::COLOR_DEFAULT),
33
- array(Logger::INFO, SlackRecord::COLOR_GOOD),
34
- array(Logger::NOTICE, SlackRecord::COLOR_GOOD),
35
- array(Logger::WARNING, SlackRecord::COLOR_WARNING),
36
- array(Logger::ERROR, SlackRecord::COLOR_DANGER),
37
- array(Logger::CRITICAL, SlackRecord::COLOR_DANGER),
38
- array(Logger::ALERT, SlackRecord::COLOR_DANGER),
39
- array(Logger::EMERGENCY, SlackRecord::COLOR_DANGER),
40
- );
41
- }
42
-
43
- /**
44
- * @dataProvider dataGetAttachmentColor
45
- * @param int $logLevel
46
- * @param string $expectedColour RGB hex color or name of Slack color
47
- * @covers ::getAttachmentColor
48
- */
49
- public function testGetAttachmentColor($logLevel, $expectedColour)
50
- {
51
- $slackRecord = new SlackRecord();
52
- $this->assertSame(
53
- $expectedColour,
54
- $slackRecord->getAttachmentColor($logLevel)
55
- );
56
- }
57
-
58
- public function testAddsChannel()
59
- {
60
- $channel = '#test';
61
- $record = new SlackRecord($channel);
62
- $data = $record->getSlackData($this->getRecord());
63
-
64
- $this->assertArrayHasKey('channel', $data);
65
- $this->assertSame($channel, $data['channel']);
66
- }
67
-
68
- public function testNoUsernameByDefault()
69
- {
70
- $record = new SlackRecord();
71
- $data = $record->getSlackData($this->getRecord());
72
-
73
- $this->assertArrayNotHasKey('username', $data);
74
- }
75
-
76
- /**
77
- * @return array
78
- */
79
- public function dataStringify()
80
- {
81
- $jsonPrettyPrintFlag = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 128;
82
-
83
- $multipleDimensions = array(array(1, 2));
84
- $numericKeys = array('library' => 'monolog');
85
- $singleDimension = array(1, 'Hello', 'Jordi');
86
-
87
- return array(
88
- array(array(), '[]'),
89
- array($multipleDimensions, json_encode($multipleDimensions, $jsonPrettyPrintFlag)),
90
- array($numericKeys, json_encode($numericKeys, $jsonPrettyPrintFlag)),
91
- array($singleDimension, json_encode($singleDimension))
92
- );
93
- }
94
-
95
- /**
96
- * @dataProvider dataStringify
97
- */
98
- public function testStringify($fields, $expectedResult)
99
- {
100
- $slackRecord = new SlackRecord(
101
- '#test',
102
- 'test',
103
- true,
104
- null,
105
- true,
106
- true
107
- );
108
-
109
- $this->assertSame($expectedResult, $slackRecord->stringify($fields));
110
- }
111
-
112
- public function testAddsCustomUsername()
113
- {
114
- $username = 'Monolog bot';
115
- $record = new SlackRecord(null, $username);
116
- $data = $record->getSlackData($this->getRecord());
117
-
118
- $this->assertArrayHasKey('username', $data);
119
- $this->assertSame($username, $data['username']);
120
- }
121
-
122
- public function testNoIcon()
123
- {
124
- $record = new SlackRecord();
125
- $data = $record->getSlackData($this->getRecord());
126
-
127
- $this->assertArrayNotHasKey('icon_emoji', $data);
128
- }
129
-
130
- public function testAddsIcon()
131
- {
132
- $record = $this->getRecord();
133
- $slackRecord = new SlackRecord(null, null, false, 'ghost');
134
- $data = $slackRecord->getSlackData($record);
135
-
136
- $slackRecord2 = new SlackRecord(null, null, false, 'http://github.com/Seldaek/monolog');
137
- $data2 = $slackRecord2->getSlackData($record);
138
-
139
- $this->assertArrayHasKey('icon_emoji', $data);
140
- $this->assertSame(':ghost:', $data['icon_emoji']);
141
- $this->assertArrayHasKey('icon_url', $data2);
142
- $this->assertSame('http://github.com/Seldaek/monolog', $data2['icon_url']);
143
- }
144
-
145
- public function testAttachmentsNotPresentIfNoAttachment()
146
- {
147
- $record = new SlackRecord(null, null, false);
148
- $data = $record->getSlackData($this->getRecord());
149
-
150
- $this->assertArrayNotHasKey('attachments', $data);
151
- }
152
-
153
- public function testAddsOneAttachment()
154
- {
155
- $record = new SlackRecord();
156
- $data = $record->getSlackData($this->getRecord());
157
-
158
- $this->assertArrayHasKey('attachments', $data);
159
- $this->assertArrayHasKey(0, $data['attachments']);
160
- $this->assertInternalType('array', $data['attachments'][0]);
161
- }
162
-
163
- public function testTextEqualsMessageIfNoAttachment()
164
- {
165
- $message = 'Test message';
166
- $record = new SlackRecord(null, null, false);
167
- $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
168
-
169
- $this->assertArrayHasKey('text', $data);
170
- $this->assertSame($message, $data['text']);
171
- }
172
-
173
- public function testTextEqualsFormatterOutput()
174
- {
175
- $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
176
- $formatter
177
- ->expects($this->any())
178
- ->method('format')
179
- ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; }));
180
-
181
- $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface');
182
- $formatter2
183
- ->expects($this->any())
184
- ->method('format')
185
- ->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; }));
186
-
187
- $message = 'Test message';
188
- $record = new SlackRecord(null, null, false, null, false, false, array(), $formatter);
189
- $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
190
-
191
- $this->assertArrayHasKey('text', $data);
192
- $this->assertSame($message . 'test', $data['text']);
193
-
194
- $record->setFormatter($formatter2);
195
- $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
196
-
197
- $this->assertArrayHasKey('text', $data);
198
- $this->assertSame($message . 'test1', $data['text']);
199
- }
200
-
201
- public function testAddsFallbackAndTextToAttachment()
202
- {
203
- $message = 'Test message';
204
- $record = new SlackRecord(null);
205
- $data = $record->getSlackData($this->getRecord(Logger::WARNING, $message));
206
-
207
- $this->assertSame($message, $data['attachments'][0]['text']);
208
- $this->assertSame($message, $data['attachments'][0]['fallback']);
209
- }
210
-
211
- public function testMapsLevelToColorAttachmentColor()
212
- {
213
- $record = new SlackRecord(null);
214
- $errorLoggerRecord = $this->getRecord(Logger::ERROR);
215
- $emergencyLoggerRecord = $this->getRecord(Logger::EMERGENCY);
216
- $warningLoggerRecord = $this->getRecord(Logger::WARNING);
217
- $infoLoggerRecord = $this->getRecord(Logger::INFO);
218
- $debugLoggerRecord = $this->getRecord(Logger::DEBUG);
219
-
220
- $data = $record->getSlackData($errorLoggerRecord);
221
- $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
222
-
223
- $data = $record->getSlackData($emergencyLoggerRecord);
224
- $this->assertSame(SlackRecord::COLOR_DANGER, $data['attachments'][0]['color']);
225
-
226
- $data = $record->getSlackData($warningLoggerRecord);
227
- $this->assertSame(SlackRecord::COLOR_WARNING, $data['attachments'][0]['color']);
228
-
229
- $data = $record->getSlackData($infoLoggerRecord);
230
- $this->assertSame(SlackRecord::COLOR_GOOD, $data['attachments'][0]['color']);
231
-
232
- $data = $record->getSlackData($debugLoggerRecord);
233
- $this->assertSame(SlackRecord::COLOR_DEFAULT, $data['attachments'][0]['color']);
234
- }
235
-
236
- public function testAddsShortAttachmentWithoutContextAndExtra()
237
- {
238
- $level = Logger::ERROR;
239
- $levelName = Logger::getLevelName($level);
240
- $record = new SlackRecord(null, null, true, null, true);
241
- $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
242
-
243
- $attachment = $data['attachments'][0];
244
- $this->assertArrayHasKey('title', $attachment);
245
- $this->assertArrayHasKey('fields', $attachment);
246
- $this->assertSame($levelName, $attachment['title']);
247
- $this->assertSame(array(), $attachment['fields']);
248
- }
249
-
250
- public function testAddsShortAttachmentWithContextAndExtra()
251
- {
252
- $level = Logger::ERROR;
253
- $levelName = Logger::getLevelName($level);
254
- $context = array('test' => 1);
255
- $extra = array('tags' => array('web'));
256
- $record = new SlackRecord(null, null, true, null, true, true);
257
- $loggerRecord = $this->getRecord($level, 'test', $context);
258
- $loggerRecord['extra'] = $extra;
259
- $data = $record->getSlackData($loggerRecord);
260
-
261
- $attachment = $data['attachments'][0];
262
- $this->assertArrayHasKey('title', $attachment);
263
- $this->assertArrayHasKey('fields', $attachment);
264
- $this->assertCount(2, $attachment['fields']);
265
- $this->assertSame($levelName, $attachment['title']);
266
- $this->assertSame(
267
- array(
268
- array(
269
- 'title' => 'Extra',
270
- 'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)),
271
- 'short' => false
272
- ),
273
- array(
274
- 'title' => 'Context',
275
- 'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)),
276
- 'short' => false
277
- )
278
- ),
279
- $attachment['fields']
280
- );
281
- }
282
-
283
- public function testAddsLongAttachmentWithoutContextAndExtra()
284
- {
285
- $level = Logger::ERROR;
286
- $levelName = Logger::getLevelName($level);
287
- $record = new SlackRecord(null, null, true, null);
288
- $data = $record->getSlackData($this->getRecord($level, 'test', array('test' => 1)));
289
-
290
- $attachment = $data['attachments'][0];
291
- $this->assertArrayHasKey('title', $attachment);
292
- $this->assertArrayHasKey('fields', $attachment);
293
- $this->assertCount(1, $attachment['fields']);
294
- $this->assertSame('Message', $attachment['title']);
295
- $this->assertSame(
296
- array(array(
297
- 'title' => 'Level',
298
- 'value' => $levelName,
299
- 'short' => false
300
- )),
301
- $attachment['fields']
302
- );
303
- }
304
-
305
- public function testAddsLongAttachmentWithContextAndExtra()
306
- {
307
- $level = Logger::ERROR;
308
- $levelName = Logger::getLevelName($level);
309
- $context = array('test' => 1);
310
- $extra = array('tags' => array('web'));
311
- $record = new SlackRecord(null, null, true, null, false, true);
312
- $loggerRecord = $this->getRecord($level, 'test', $context);
313
- $loggerRecord['extra'] = $extra;
314
- $data = $record->getSlackData($loggerRecord);
315
-
316
- $expectedFields = array(
317
- array(
318
- 'title' => 'Level',
319
- 'value' => $levelName,
320
- 'short' => false,
321
- ),
322
- array(
323
- 'title' => 'tags',
324
- 'value' => sprintf('```%s```', json_encode($extra['tags'])),
325
- 'short' => false
326
- ),
327
- array(
328
- 'title' => 'test',
329
- 'value' => $context['test'],
330
- 'short' => false
331
- )
332
- );
333
-
334
- $attachment = $data['attachments'][0];
335
- $this->assertArrayHasKey('title', $attachment);
336
- $this->assertArrayHasKey('fields', $attachment);
337
- $this->assertCount(3, $attachment['fields']);
338
- $this->assertSame('Message', $attachment['title']);
339
- $this->assertSame(
340
- $expectedFields,
341
- $attachment['fields']
342
- );
343
- }
344
-
345
- public function testAddsTimestampToAttachment()
346
- {
347
- $record = $this->getRecord();
348
- $slackRecord = new SlackRecord();
349
- $data = $slackRecord->getSlackData($this->getRecord());
350
-
351
- $attachment = $data['attachments'][0];
352
- $this->assertArrayHasKey('ts', $attachment);
353
- $this->assertSame($record['datetime']->getTimestamp(), $attachment['ts']);
354
- }
355
-
356
- public function testExcludeExtraAndContextFields()
357
- {
358
- $record = $this->getRecord(
359
- Logger::WARNING,
360
- 'test',
361
- array('info' => array('library' => 'monolog', 'author' => 'Jordi'))
362
- );
363
- $record['extra'] = array('tags' => array('web', 'cli'));
364
-
365
- $slackRecord = new SlackRecord(null, null, true, null, false, true, array('context.info.library', 'extra.tags.1'));
366
- $data = $slackRecord->getSlackData($record);
367
- $attachment = $data['attachments'][0];
368
-
369
- $expected = array(
370
- array(
371
- 'title' => 'info',
372
- 'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)),
373
- 'short' => false
374
- ),
375
- array(
376
- 'title' => 'tags',
377
- 'value' => sprintf('```%s```', json_encode(array('web'))),
378
- 'short' => false
379
- ),
380
- );
381
-
382
- foreach ($expected as $field) {
383
- $this->assertNotFalse(array_search($field, $attachment['fields']));
384
- break;
385
- }
386
- }
387
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/tests/Monolog/Handler/SlackWebhookHandlerTest.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Monolog package.
5
- *
6
- * (c) Jordi Boggiano <j.boggiano@seld.be>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Monolog\Handler;
13
-
14
- use Monolog\TestCase;
15
- use Monolog\Logger;
16
- use Monolog\Formatter\LineFormatter;
17
- use Monolog\Handler\Slack\SlackRecord;
18
-
19
- /**
20
- * @author Haralan Dobrev <hkdobrev@gmail.com>
21
- * @see https://api.slack.com/incoming-webhooks
22
- * @coversDefaultClass Monolog\Handler\SlackWebhookHandler
23
- */
24
- class SlackWebhookHandlerTest extends TestCase
25
- {
26
- const WEBHOOK_URL = 'https://hooks.slack.com/services/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E';
27
-
28
- /**
29
- * @covers ::__construct
30
- * @covers ::getSlackRecord
31
- */
32
- public function testConstructorMinimal()
33
- {
34
- $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
35
- $record = $this->getRecord();
36
- $slackRecord = $handler->getSlackRecord();
37
- $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
38
- $this->assertEquals(array(
39
- 'attachments' => array(
40
- array(
41
- 'fallback' => 'test',
42
- 'text' => 'test',
43
- 'color' => SlackRecord::COLOR_WARNING,
44
- 'fields' => array(
45
- array(
46
- 'title' => 'Level',
47
- 'value' => 'WARNING',
48
- 'short' => false,
49
- ),
50
- ),
51
- 'title' => 'Message',
52
- 'mrkdwn_in' => array('fields'),
53
- 'ts' => $record['datetime']->getTimestamp(),
54
- ),
55
- ),
56
- ), $slackRecord->getSlackData($record));
57
- }
58
-
59
- /**
60
- * @covers ::__construct
61
- * @covers ::getSlackRecord
62
- */
63
- public function testConstructorFull()
64
- {
65
- $handler = new SlackWebhookHandler(
66
- self::WEBHOOK_URL,
67
- 'test-channel',
68
- 'test-username',
69
- false,
70
- ':ghost:',
71
- false,
72
- false,
73
- Logger::DEBUG,
74
- false
75
- );
76
-
77
- $slackRecord = $handler->getSlackRecord();
78
- $this->assertInstanceOf('Monolog\Handler\Slack\SlackRecord', $slackRecord);
79
- $this->assertEquals(array(
80
- 'username' => 'test-username',
81
- 'text' => 'test',
82
- 'channel' => 'test-channel',
83
- 'icon_emoji' => ':ghost:',
84
- ), $slackRecord->getSlackData($this->getRecord()));
85
- }
86
-
87
- /**
88
- * @covers ::getFormatter
89
- */
90
- public function testGetFormatter()
91
- {
92
- $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
93
- $formatter = $handler->getFormatter();
94
- $this->assertInstanceOf('Monolog\Formatter\FormatterInterface', $formatter);
95
- }
96
-
97
- /**
98
- * @covers ::setFormatter
99
- */
100
- public function testSetFormatter()
101
- {
102
- $handler = new SlackWebhookHandler(self::WEBHOOK_URL);
103
- $formatter = new LineFormatter();
104
- $handler->setFormatter($formatter);
105
- $this->assertSame($formatter, $handler->getFormatter());
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/tests/Monolog/Handler/SlackbotHandlerTest.php DELETED
@@ -1,47 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Monolog package.
5
- *
6
- * (c) Jordi Boggiano <j.boggiano@seld.be>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Monolog\Handler;
13
-
14
- use Monolog\TestCase;
15
- use Monolog\Logger;
16
-
17
- /**
18
- * @author Haralan Dobrev <hkdobrev@gmail.com>
19
- * @see https://slack.com/apps/A0F81R8ET-slackbot
20
- * @coversDefaultClass Monolog\Handler\SlackbotHandler
21
- */
22
- class SlackbotHandlerTest extends TestCase
23
- {
24
- /**
25
- * @covers ::__construct
26
- */
27
- public function testConstructorMinimal()
28
- {
29
- $handler = new SlackbotHandler('test-team', 'test-token', 'test-channel');
30
- $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
31
- }
32
-
33
- /**
34
- * @covers ::__construct
35
- */
36
- public function testConstructorFull()
37
- {
38
- $handler = new SlackbotHandler(
39
- 'test-team',
40
- 'test-token',
41
- 'test-channel',
42
- Logger::DEBUG,
43
- false
44
- );
45
- $this->assertInstanceOf('Monolog\Handler\AbstractProcessingHandler', $handler);
46
- }
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/tests/Monolog/Processor/MercurialProcessorTest.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Monolog package.
5
- *
6
- * (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Monolog\Processor;
13
-
14
- use Monolog\TestCase;
15
-
16
- class MercurialProcessorTest extends TestCase
17
- {
18
- /**
19
- * @covers Monolog\Processor\MercurialProcessor::__invoke
20
- */
21
- public function testProcessor()
22
- {
23
- if (defined('PHP_WINDOWS_VERSION_BUILD')) {
24
- exec("where hg 2>NUL", $output, $result);
25
- } else {
26
- exec("which hg 2>/dev/null >/dev/null", $output, $result);
27
- }
28
- if ($result != 0) {
29
- $this->markTestSkipped('hg is missing');
30
- return;
31
- }
32
-
33
- `hg init`;
34
- $processor = new MercurialProcessor();
35
- $record = $processor($this->getRecord());
36
-
37
- $this->assertArrayHasKey('hg', $record['extra']);
38
- $this->assertTrue(!is_array($record['extra']['hg']['branch']));
39
- $this->assertTrue(!is_array($record['extra']['hg']['revision']));
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/monolog/monolog/vendor/psr/log/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2012 PHP Framework Interoperability Group
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
vendor/monolog/monolog/vendor/psr/log/Psr/Log/AbstractLogger.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * This is a simple Logger implementation that other Loggers can inherit from.
7
+ *
8
+ * It simply delegates all log-level-specific methods to the `log` method to
9
+ * reduce boilerplate code that a simple Logger that does the same thing with
10
+ * messages regardless of the error level has to implement.
11
+ */
12
+ abstract class AbstractLogger implements LoggerInterface
13
+ {
14
+ /**
15
+ * System is unusable.
16
+ *
17
+ * @param string $message
18
+ * @param array $context
19
+ *
20
+ * @return void
21
+ */
22
+ public function emergency($message, array $context = array())
23
+ {
24
+ $this->log(LogLevel::EMERGENCY, $message, $context);
25
+ }
26
+
27
+ /**
28
+ * Action must be taken immediately.
29
+ *
30
+ * Example: Entire website down, database unavailable, etc. This should
31
+ * trigger the SMS alerts and wake you up.
32
+ *
33
+ * @param string $message
34
+ * @param array $context
35
+ *
36
+ * @return void
37
+ */
38
+ public function alert($message, array $context = array())
39
+ {
40
+ $this->log(LogLevel::ALERT, $message, $context);
41
+ }
42
+
43
+ /**
44
+ * Critical conditions.
45
+ *
46
+ * Example: Application component unavailable, unexpected exception.
47
+ *
48
+ * @param string $message
49
+ * @param array $context
50
+ *
51
+ * @return void
52
+ */
53
+ public function critical($message, array $context = array())
54
+ {
55
+ $this->log(LogLevel::CRITICAL, $message, $context);
56
+ }
57
+
58
+ /**
59
+ * Runtime errors that do not require immediate action but should typically
60
+ * be logged and monitored.
61
+ *
62
+ * @param string $message
63
+ * @param array $context
64
+ *
65
+ * @return void
66
+ */
67
+ public function error($message, array $context = array())
68
+ {
69
+ $this->log(LogLevel::ERROR, $message, $context);
70
+ }
71
+
72
+ /**
73
+ * Exceptional occurrences that are not errors.
74
+ *
75
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
76
+ * that are not necessarily wrong.
77
+ *
78
+ * @param string $message
79
+ * @param array $context
80
+ *
81
+ * @return void
82
+ */
83
+ public function warning($message, array $context = array())
84
+ {
85
+ $this->log(LogLevel::WARNING, $message, $context);
86
+ }
87
+
88
+ /**
89
+ * Normal but significant events.
90
+ *
91
+ * @param string $message
92
+ * @param array $context
93
+ *
94
+ * @return void
95
+ */
96
+ public function notice($message, array $context = array())
97
+ {
98
+ $this->log(LogLevel::NOTICE, $message, $context);
99
+ }
100
+
101
+ /**
102
+ * Interesting events.
103
+ *
104
+ * Example: User logs in, SQL logs.
105
+ *
106
+ * @param string $message
107
+ * @param array $context
108
+ *
109
+ * @return void
110
+ */
111
+ public function info($message, array $context = array())
112
+ {
113
+ $this->log(LogLevel::INFO, $message, $context);
114
+ }
115
+
116
+ /**
117
+ * Detailed debug information.
118
+ *
119
+ * @param string $message
120
+ * @param array $context
121
+ *
122
+ * @return void
123
+ */
124
+ public function debug($message, array $context = array())
125
+ {
126
+ $this->log(LogLevel::DEBUG, $message, $context);
127
+ }
128
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/InvalidArgumentException.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ class InvalidArgumentException extends \InvalidArgumentException
6
+ {
7
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/LogLevel.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * Describes log levels.
7
+ */
8
+ class LogLevel
9
+ {
10
+ const EMERGENCY = 'emergency';
11
+ const ALERT = 'alert';
12
+ const CRITICAL = 'critical';
13
+ const ERROR = 'error';
14
+ const WARNING = 'warning';
15
+ const NOTICE = 'notice';
16
+ const INFO = 'info';
17
+ const DEBUG = 'debug';
18
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerAwareInterface.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * Describes a logger-aware instance.
7
+ */
8
+ interface LoggerAwareInterface
9
+ {
10
+ /**
11
+ * Sets a logger instance on the object.
12
+ *
13
+ * @param LoggerInterface $logger
14
+ *
15
+ * @return void
16
+ */
17
+ public function setLogger(LoggerInterface $logger);
18
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerAwareTrait.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * Basic Implementation of LoggerAwareInterface.
7
+ */
8
+ trait LoggerAwareTrait
9
+ {
10
+ /**
11
+ * The logger instance.
12
+ *
13
+ * @var LoggerInterface
14
+ */
15
+ protected $logger;
16
+
17
+ /**
18
+ * Sets a logger.
19
+ *
20
+ * @param LoggerInterface $logger
21
+ */
22
+ public function setLogger(LoggerInterface $logger)
23
+ {
24
+ $this->logger = $logger;
25
+ }
26
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerInterface.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * Describes a logger instance.
7
+ *
8
+ * The message MUST be a string or object implementing __toString().
9
+ *
10
+ * The message MAY contain placeholders in the form: {foo} where foo
11
+ * will be replaced by the context data in key "foo".
12
+ *
13
+ * The context array can contain arbitrary data. The only assumption that
14
+ * can be made by implementors is that if an Exception instance is given
15
+ * to produce a stack trace, it MUST be in a key named "exception".
16
+ *
17
+ * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
18
+ * for the full interface specification.
19
+ */
20
+ interface LoggerInterface
21
+ {
22
+ /**
23
+ * System is unusable.
24
+ *
25
+ * @param string $message
26
+ * @param array $context
27
+ *
28
+ * @return void
29
+ */
30
+ public function emergency($message, array $context = array());
31
+
32
+ /**
33
+ * Action must be taken immediately.
34
+ *
35
+ * Example: Entire website down, database unavailable, etc. This should
36
+ * trigger the SMS alerts and wake you up.
37
+ *
38
+ * @param string $message
39
+ * @param array $context
40
+ *
41
+ * @return void
42
+ */
43
+ public function alert($message, array $context = array());
44
+
45
+ /**
46
+ * Critical conditions.
47
+ *
48
+ * Example: Application component unavailable, unexpected exception.
49
+ *
50
+ * @param string $message
51
+ * @param array $context
52
+ *
53
+ * @return void
54
+ */
55
+ public function critical($message, array $context = array());
56
+
57
+ /**
58
+ * Runtime errors that do not require immediate action but should typically
59
+ * be logged and monitored.
60
+ *
61
+ * @param string $message
62
+ * @param array $context
63
+ *
64
+ * @return void
65
+ */
66
+ public function error($message, array $context = array());
67
+
68
+ /**
69
+ * Exceptional occurrences that are not errors.
70
+ *
71
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
72
+ * that are not necessarily wrong.
73
+ *
74
+ * @param string $message
75
+ * @param array $context
76
+ *
77
+ * @return void
78
+ */
79
+ public function warning($message, array $context = array());
80
+
81
+ /**
82
+ * Normal but significant events.
83
+ *
84
+ * @param string $message
85
+ * @param array $context
86
+ *
87
+ * @return void
88
+ */
89
+ public function notice($message, array $context = array());
90
+
91
+ /**
92
+ * Interesting events.
93
+ *
94
+ * Example: User logs in, SQL logs.
95
+ *
96
+ * @param string $message
97
+ * @param array $context
98
+ *
99
+ * @return void
100
+ */
101
+ public function info($message, array $context = array());
102
+
103
+ /**
104
+ * Detailed debug information.
105
+ *
106
+ * @param string $message
107
+ * @param array $context
108
+ *
109
+ * @return void
110
+ */
111
+ public function debug($message, array $context = array());
112
+
113
+ /**
114
+ * Logs with an arbitrary level.
115
+ *
116
+ * @param mixed $level
117
+ * @param string $message
118
+ * @param array $context
119
+ *
120
+ * @return void
121
+ */
122
+ public function log($level, $message, array $context = array());
123
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/LoggerTrait.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * This is a simple Logger trait that classes unable to extend AbstractLogger
7
+ * (because they extend another class, etc) can include.
8
+ *
9
+ * It simply delegates all log-level-specific methods to the `log` method to
10
+ * reduce boilerplate code that a simple Logger that does the same thing with
11
+ * messages regardless of the error level has to implement.
12
+ */
13
+ trait LoggerTrait
14
+ {
15
+ /**
16
+ * System is unusable.
17
+ *
18
+ * @param string $message
19
+ * @param array $context
20
+ *
21
+ * @return void
22
+ */
23
+ public function emergency($message, array $context = array())
24
+ {
25
+ $this->log(LogLevel::EMERGENCY, $message, $context);
26
+ }
27
+
28
+ /**
29
+ * Action must be taken immediately.
30
+ *
31
+ * Example: Entire website down, database unavailable, etc. This should
32
+ * trigger the SMS alerts and wake you up.
33
+ *
34
+ * @param string $message
35
+ * @param array $context
36
+ *
37
+ * @return void
38
+ */
39
+ public function alert($message, array $context = array())
40
+ {
41
+ $this->log(LogLevel::ALERT, $message, $context);
42
+ }
43
+
44
+ /**
45
+ * Critical conditions.
46
+ *
47
+ * Example: Application component unavailable, unexpected exception.
48
+ *
49
+ * @param string $message
50
+ * @param array $context
51
+ *
52
+ * @return void
53
+ */
54
+ public function critical($message, array $context = array())
55
+ {
56
+ $this->log(LogLevel::CRITICAL, $message, $context);
57
+ }
58
+
59
+ /**
60
+ * Runtime errors that do not require immediate action but should typically
61
+ * be logged and monitored.
62
+ *
63
+ * @param string $message
64
+ * @param array $context
65
+ *
66
+ * @return void
67
+ */
68
+ public function error($message, array $context = array())
69
+ {
70
+ $this->log(LogLevel::ERROR, $message, $context);
71
+ }
72
+
73
+ /**
74
+ * Exceptional occurrences that are not errors.
75
+ *
76
+ * Example: Use of deprecated APIs, poor use of an API, undesirable things
77
+ * that are not necessarily wrong.
78
+ *
79
+ * @param string $message
80
+ * @param array $context
81
+ *
82
+ * @return void
83
+ */
84
+ public function warning($message, array $context = array())
85
+ {
86
+ $this->log(LogLevel::WARNING, $message, $context);
87
+ }
88
+
89
+ /**
90
+ * Normal but significant events.
91
+ *
92
+ * @param string $message
93
+ * @param array $context
94
+ *
95
+ * @return void
96
+ */
97
+ public function notice($message, array $context = array())
98
+ {
99
+ $this->log(LogLevel::NOTICE, $message, $context);
100
+ }
101
+
102
+ /**
103
+ * Interesting events.
104
+ *
105
+ * Example: User logs in, SQL logs.
106
+ *
107
+ * @param string $message
108
+ * @param array $context
109
+ *
110
+ * @return void
111
+ */
112
+ public function info($message, array $context = array())
113
+ {
114
+ $this->log(LogLevel::INFO, $message, $context);
115
+ }
116
+
117
+ /**
118
+ * Detailed debug information.
119
+ *
120
+ * @param string $message
121
+ * @param array $context
122
+ *
123
+ * @return void
124
+ */
125
+ public function debug($message, array $context = array())
126
+ {
127
+ $this->log(LogLevel::DEBUG, $message, $context);
128
+ }
129
+
130
+ /**
131
+ * Logs with an arbitrary level.
132
+ *
133
+ * @param mixed $level
134
+ * @param string $message
135
+ * @param array $context
136
+ *
137
+ * @return void
138
+ */
139
+ abstract public function log($level, $message, array $context = array());
140
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/NullLogger.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log;
4
+
5
+ /**
6
+ * This Logger can be used to avoid conditional log calls.
7
+ *
8
+ * Logging should always be optional, and if no logger is provided to your
9
+ * library creating a NullLogger instance to have something to throw logs at
10
+ * is a good way to avoid littering your code with `if ($this->logger) { }`
11
+ * blocks.
12
+ */
13
+ class NullLogger extends AbstractLogger
14
+ {
15
+ /**
16
+ * Logs with an arbitrary level.
17
+ *
18
+ * @param mixed $level
19
+ * @param string $message
20
+ * @param array $context
21
+ *
22
+ * @return void
23
+ */
24
+ public function log($level, $message, array $context = array())
25
+ {
26
+ // noop
27
+ }
28
+ }
vendor/monolog/monolog/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Psr\Log\Test;
4
+
5
+ use Psr\Log\LoggerInterface;
6
+ use Psr\Log\LogLevel;
7
+
8
+ /**
9
+ * Provides a base test class for ensuring compliance with the LoggerInterface.
10
+ *
11
+ * Implementors can extend the class and implement abstract methods to run this
12
+ * as part of their test suite.
13
+ */
14
+ abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
15
+ {
16
+ /**
17
+ * @return LoggerInterface
18
+ */
19
+ abstract public function getLogger();
20
+
21
+ /**
22
+ * This must return the log messages in order.
23
+ *
24
+ * The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>".
25
+ *
26
+ * Example ->error('Foo') would yield "error Foo".
27
+ *
28
+ * @return string[]
29
+ */
30
+ abstract public function getLogs();
31
+
32
+ public function testImplements()
33
+ {
34
+ $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
35
+ }
36
+
37
+ /**
38
+ * @dataProvider provideLevelsAndMessages
39
+ */
40
+ public function testLogsAtAllLevels($level, $message)
41
+ {
42
+ $logger = $this->getLogger();
43
+ $logger->{$level}($message, array('user' => 'Bob'));
44
+ $logger->log($level, $message, array('user' => 'Bob'));
45
+
46
+ $expected = array(
47
+ $level.' message of level '.$level.' with context: Bob',
48
+ $level.' message of level '.$level.' with context: Bob',
49
+ );
50
+ $this->assertEquals($expected, $this->getLogs());
51
+ }
52
+
53
+ public function provideLevelsAndMessages()
54
+ {
55
+ return array(
56
+ LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
57
+ LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
58
+ LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
59
+ LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
60
+ LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
61
+ LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
62
+ LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
63
+ LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
64
+ );
65
+ }
66
+
67
+ /**
68
+ * @expectedException \Psr\Log\InvalidArgumentException
69
+ */
70
+ public function testThrowsOnInvalidLevel()
71
+ {
72
+ $logger = $this->getLogger();
73
+ $logger->log('invalid level', 'Foo');
74
+ }
75
+
76
+ public function testContextReplacement()
77
+ {
78
+ $logger = $this->getLogger();
79
+ $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
80
+
81
+ $expected = array('info {Message {nothing} Bob Bar a}');
82
+ $this->assertEquals($expected, $this->getLogs());
83
+ }
84
+
85
+ public function testObjectCastToString()
86
+ {
87
+ if (method_exists($this, 'createPartialMock')) {
88
+ $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
89
+ } else {
90
+ $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
91
+ }
92
+ $dummy->expects($this->once())
93
+ ->method('__toString')
94
+ ->will($this->returnValue('DUMMY'));
95
+
96
+ $this->getLogger()->warning($dummy);
97
+
98
+ $expected = array('warning DUMMY');
99
+ $this->assertEquals($expected, $this->getLogs());
100
+ }
101
+
102
+ public function testContextCanContainAnything()
103
+ {
104
+ $context = array(
105
+ 'bool' => true,
106
+ 'null' => null,
107
+ 'string' => 'Foo',
108
+ 'int' => 0,
109
+ 'float' => 0.5,
110
+ 'nested' => array('with object' => new DummyTest),
111
+ 'object' => new \DateTime,
112
+ 'resource' => fopen('php://memory', 'r'),
113
+ );
114
+
115
+ $this->getLogger()->warning('Crazy context data', $context);
116
+
117
+ $expected = array('warning Crazy context data');
118
+ $this->assertEquals($expected, $this->getLogs());
119
+ }
120
+
121
+ public function testContextExceptionKeyCanBeExceptionOrOtherValues()
122
+ {
123
+ $logger = $this->getLogger();
124
+ $logger->warning('Random message', array('exception' => 'oops'));
125
+ $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
126
+
127
+ $expected = array(
128
+ 'warning Random message',
129
+ 'critical Uncaught Exception!'
130
+ );
131
+ $this->assertEquals($expected, $this->getLogs());
132
+ }
133
+ }
134
+
135
+ class DummyTest
136
+ {
137
+ public function __toString()
138
+ {
139
+ }
140
+ }
vendor/monolog/monolog/vendor/psr/log/README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PSR Log
2
+ =======
3
+
4
+ This repository holds all interfaces/classes/traits related to
5
+ [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
6
+
7
+ Note that this is not a logger of its own. It is merely an interface that
8
+ describes a logger. See the specification for more details.
9
+
10
+ Usage
11
+ -----
12
+
13
+ If you need a logger, you can use the interface like this:
14
+
15
+ ```php
16
+ <?php
17
+
18
+ use Psr\Log\LoggerInterface;
19
+
20
+ class Foo
21
+ {
22
+ private $logger;
23
+
24
+ public function __construct(LoggerInterface $logger = null)
25
+ {
26
+ $this->logger = $logger;
27
+ }
28
+
29
+ public function doSomething()
30
+ {
31
+ if ($this->logger) {
32
+ $this->logger->info('Doing work');
33
+ }
34
+
35
+ // do something useful
36
+ }
37
+ }
38
+ ```
39
+
40
+ You can then pick one of the implementations of the interface to get a logger.
41
+
42
+ If you want to implement the interface, you can require this package and
43
+ implement `Psr\Log\LoggerInterface` in your code. Please read the
44
+ [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
45
+ for details.
vendor/monolog/monolog/vendor/psr/log/composer.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "psr/log",
3
+ "description": "Common interface for logging libraries",
4
+ "keywords": ["psr", "psr-3", "log"],
5
+ "homepage": "https://github.com/php-fig/log",
6
+ "license": "MIT",
7
+ "authors": [
8
+ {
9
+ "name": "PHP-FIG",
10
+ "homepage": "http://www.php-fig.org/"
11
+ }
12
+ ],
13
+ "require": {
14
+ "php": ">=5.3.0"
15
+ },
16
+ "autoload": {
17
+ "psr-4": {
18
+ "Psr\\Log\\": "Psr/Log/"
19
+ }
20
+ },
21
+ "extra": {
22
+ "branch-alias": {
23
+ "dev-master": "1.0.x-dev"
24
+ }
25
+ }
26
+ }