1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 09:36:11 +02:00
Commit Graph

96 Commits

Author SHA1 Message Date
Jordi Boggiano
4a43d9b17c Fix microseconds support on 7.1, and enable it by default as 7.1 has no perf cost anymore 2016-11-14 11:53:15 +01:00
Jordi Boggiano
5ce1c921ad Fix type errors, thanks phan 2016-09-25 22:11:37 +02:00
Jordi Boggiano
6e6586257d Add scalar types to processor/formatters and top level classes 2016-09-25 21:23:35 +02:00
Jordi Boggiano
760dc44ebd Remove redundant setTimezone call 2016-09-25 18:39:28 +02:00
Jordi Boggiano
96f4fd718f CS fixes 2016-09-25 17:46:38 +02:00
krzysiekpiasecki
4ebf6fa43f Declaring That a Logger Can Throw an Exception 2016-08-29 20:46:48 +02:00
Jordi Boggiano
7efec0eeab Fix timezone param handling 2016-06-25 16:46:53 +01:00
Jordi Boggiano
21dde4dedb Move to strict mode and fix tests 2016-05-27 13:44:00 +01:00
Jordi Boggiano
f200e79879 CS fixes 2016-05-26 20:54:06 +01:00
Jordi Boggiano
912d813c73 Add our own DateTime implementation to provide nicer JSON output, fixes #736 2016-05-20 21:33:27 +01:00
Jordi Boggiano
e27225dc40 Switch to DateTimeImmutable everywhere 2016-05-20 20:55:31 +01:00
Jordi Boggiano
2a569ff961 Disable microsecond precision by default 2016-05-20 20:25:27 +01:00
Jordi Boggiano
a00acb6022 Clarify var purpose 2016-05-20 19:47:45 +01:00
Jordi Boggiano
f1091c3b97 CS fixes 2016-03-01 18:12:45 +00:00
Jordi Boggiano
ba995ffd1e Merge branch '1.x' 2016-03-01 17:15:43 +00:00
Jordi Boggiano
cb2778ae77 Add ->withName to clone a handler and get a new name, fixes #730 2016-02-13 16:47:31 +00:00
Jordi Boggiano
6c424f851c Add a lot more scalar types and go strict in Logger 2015-12-18 17:48:48 +00:00
Jordi Boggiano
ad37b7b2d1 Remove default handler when no handlers are set 2015-12-18 17:48:41 +00:00
Jordi Boggiano
39f8a20e6d Remove non-PSR-3 methods for adding log records 2015-12-18 17:48:38 +00:00
Jordi Boggiano
35ce15e098 Bump Monolog\Logger::API version 2015-12-18 17:48:37 +00:00
Jordi Boggiano
6505e02fd3 Change timezone to be per-instance and not global 2015-12-18 17:48:36 +00:00
Robbie Averill
ea2bef43a9 DRY: Use constants for level codes instead of re-defining 2015-12-16 09:34:12 +13:00
Jordi Boggiano
cab3ff71ff Add regression test for #691 and optimize implementation using a single pass loop over the handlers, refs #692 2015-11-26 23:48:42 +00:00
Matt Johnson
73876ace65 Changed iterating over the $handlers array to allow for correct sequential processing regardless of array containing indexed numerical keys, or associative string keys in the array.
It iterates over the entire array until it finds the $handlerKey that was identified earlier using isHandling(). Once the starting position is found it will execute handle() on each handler unless a handler returns true indicating the handler completed the processing of the record, bubbling to the next handler should not occur, and the loop breaks.

This fixes an issue where an associative array of handlers is passed into the Logger constructor when instantiated.
magento/magento2#2529
Seldaek/monolog#691
2015-11-26 02:33:02 -06:00
Jordi Boggiano
c889fb2648 CS fixes & upgrading cs fixer config 2015-11-18 17:09:46 +00:00
Bryan Davis
4e69837afc Optionally reduce timestamp resolution for performance
Introduce a new `useMicrosecondTimestamps()` method to Logger that
allows runtime selection of whether or not to create microsecond
resolution timestamps for log records.

Generating microsecond resolution timestamps by calling
`microtime(true)`, formatting the result via `sprintf()` and then
parsing the resulting string via `DateTime::createFromFormat` can incur
a measurable runtime overhead vs simple usage of `new DateTime` to
capture a second resolution timestamp in systems which generate a large
number of log events.

The default behavior of generating high precision timestamps remains the
same, but may be changed in a future release. Users requiring high
precision timestamps are encouraged to explicitly call
`Monolog\Logger::useMicrosecondTimestamps(true)` in their setup code.

Closes #657
2015-10-25 15:13:43 -06:00
Jordi Boggiano
419ca7ac25 Tweak patch a bit, refs #617 2015-08-09 18:28:21 +01:00
Sam Minnee
60c96cfa2a Added Logger::setHandlers()
Logger::setHandlers() is intended to help dependency injection systems
that deal more elegantly with property setters than constructor
arguments. Alongside getHandlers(), pushHandler(), popHandler(), it is
a logical addition to the API.

It also attempts to address some possible errors in the format of the
data passed:

 - If a map is passed, the keys are removed, as these aren’t expected
   by Monolog
 - If falsey values are included, these are stripped

It relies on Logger::pushHandler() internally, so that if any special
behaviour is added in the future, this only needs to be added in one
place.
2015-07-28 13:15:02 +12:00
Jordi Boggiano
ca1376bd61 CS fixes 2015-07-14 10:26:05 +01:00
Jordi Boggiano
8c4b1be4a2 Change Logger::setTimezone to accept a DateTimeZone object, refs #566 2015-06-01 21:15:07 +01:00
Bryan Davis
5d7db08106 Add Logger::setTimezone()
Add a setter method to allow changing the timezone used when creating
new log records. This provides a means to correct a behavioral change
introduced by 6cbdc04 where use of the PHP runtime default timezone
provided by `date_default_timezone_get()` was introduced. In most
environments the new default behavior is preferable, but if an
application allows the default timezone to vary between requests it
causes confusing log output.
2015-05-20 22:05:03 -06:00
Ron Kirschler
657989dd22 Added self-referenced returns to get fluent interfaces for Monolog\Logger::pushProcessor and Monolog\Logger::pushHandler
For more information, look at the [comment in this file](8cb4d9237c/docs/index.md (combine-with-monolog)).
2015-05-07 21:39:48 +02:00
Reda Bouchaala
2cb4a57490 Removed Logger::toMonologLevel() code duplication and added relevant tests 2015-04-25 19:42:19 +01:00
tiagowbpr
59c52eeea5 Php docs small error 2014-12-05 23:46:37 -02:00
Jordi Boggiano
673e275c00 Update comments 2014-12-04 15:11:17 +00:00
Edson Medina
ae68665460 getLevelName needs to be called earlier, so it can still thrown
exceptions for invalid levels even without a handler
2014-12-02 23:51:28 +00:00
Edson Medina
38f8dc52de Avoid calling expensive methods before checking we need to 2014-12-02 22:07:18 +00:00
Jordi Boggiano
feb19af2d4 Add support for PSR-3 levels to all public APIs accepting levels, fixes #421 2014-09-30 13:59:45 +01:00
Jordi Boggiano
467e30a9c9 Add getters for handlers/processors, fixes #363 2014-05-01 17:55:56 +02:00
Jordi Boggiano
97f79f7ed3 Fix docblock, fixes #358 2014-04-21 20:22:17 +02:00
Michael Grinko
fab4ec2c12 [minor] Indent was fixed 2014-01-15 11:01:53 +02:00
Jordi Boggiano
3926d95f8a CS fixes 2013-12-26 11:43:12 +01:00
Markus Staab
100a1b01f2 Minor phpdoc fixes 2013-12-26 00:25:22 +01:00
Peter Kokot
97043a326c logging levels phpdoc added 2013-09-21 23:43:29 +02:00
Jordi Boggiano
e2b412846d Add API version to Logger class 2013-05-21 20:36:09 +02:00
Jordi Boggiano
7e56792987 Fix docblock 2013-04-23 11:10:54 +02:00
Joshua Jabbour
6a8154756e Flip getLevels() response. 2013-04-15 12:24:24 -05:00
Joshua Jabbour
85dbaf9733 Add getter to return all supported log levels. 2013-04-15 11:46:35 -05:00
Eduardo Oliveira
f84f58188c At isHandling remove unused variable on foreach 2013-03-24 12:11:22 +00:00
Jordi Boggiano
9f515d47ce Add possibility to pass handlers/processors to Logger::__construct, fixes #157 2013-02-13 19:06:07 +01:00