1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 08:36:33 +02:00
Commit Graph

82 Commits

Author SHA1 Message Date
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
Florin Patan
5191ce91a1 Deferred timezone creation 2013-02-10 12:07:16 +02:00
Jordi Boggiano
7913cd2c4d Add psr/log compatibility 2013-01-04 17:20:27 +01:00
Jordi Boggiano
cb83512ca5 Make isHandling create the minimum required record 2012-12-21 09:41:30 +01:00
Jordi Boggiano
b23cfd3d6c Throw an exception on invalid level name 2012-11-14 16:46:10 +01:00
Thomas Rabaix
5e0fabeb0d Add the timezone in the the \DateTime constructor. While the DateTime object
is initialized without the DateTimeZone instance, the underline library
execute a stat('.../Europe/Paris') to check if the OS knows the timezone.

This will improve performance on long run process by avoiding unless i/o calls.
2012-10-24 14:58:02 +02:00
Aizat Faiz
938b608c6c Use late static binding to allow people to extend Logger 2012-10-19 08:12:34 -07:00
Jimmy Berry
48729c02c8 Correct handler comment. 2012-09-07 23:06:35 -07:00
Jordi Boggiano
6cbdc0410c Set default timezone on log records, fixes #94 2012-06-26 14:56:24 +02:00
Jordi Boggiano
c8ca42764c Cosmetic fixes 2012-06-19 20:39:54 +02:00
Jordi Boggiano
61359a972b Merge remote-tracking branch 'FGM/master' 2012-06-19 20:28:04 +02:00
Jordi Boggiano
da33c84d07 CS fixes 2012-06-14 15:47:01 +02:00
Frederic G. MARAND
07aac12c72 Implement the 8 RFC3164 severity levels instead of just 6.
- constants defined for the 2 missing levels: NOTICE and EMERGENCY.
- add<level>() and <level>() convenience methods added.
- TestHandler and tests updated to account for the two extra levels.
- surjective mappings from the RFC3164 to only 6 levels changes to bijective.
- README updated accordingly.
2012-05-28 20:29:27 +02:00
Jordi Boggiano
a6c24f983a Use non-locale aware version of the float formatter, fixes #65 2012-04-22 18:33:26 +02:00
Chris Sedlmayr
0b073c87ef A couple of small comment changes to fix some slightly broken English.
* Fixes a small typo
* Fixes incorrect indefinite article usage
* Fixes small grammatical error
2012-04-17 21:20:31 +02:00