1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 06:06:40 +02:00

72 Commits

Author SHA1 Message Date
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
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
Reda Bouchaala
2cb4a57490 Removed Logger::toMonologLevel() code duplication and added relevant tests 2015-04-25 19:42:19 +01:00
Jordi Boggiano
392ef35fd4 CS fixes 2014-03-23 20:50:26 +01:00
Jordi Boggiano
9f515d47ce Add possibility to pass handlers/processors to Logger::__construct, fixes #157 2013-02-13 19:06:07 +01:00
Jordi Boggiano
9c8db38385 CS fixes 2012-12-14 12:15:30 +01:00
Jordi Boggiano
b23cfd3d6c Throw an exception on invalid level name 2012-11-14 16:46:10 +01: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
355123d607 Add isHandling, fixes #53 2012-01-28 14:43:55 +01:00
Christophe Coevoet
64009a5880 Added more tests for the logger 2011-09-06 23:37:29 +02:00
Christophe Coevoet
10e5ecd409 Added some tests 2011-08-29 15:00:28 +02:00
Artem Nezvigin
f31388ec42 Added logger name getter, Monolog\Logger::getName()
Added phpunit.xml to .gitignore to prevent contributors from accidentally commiting theirs.
2011-08-07 16:29:10 -07:00
Jordi Boggiano
66c1cc05a8 More testing coverage 2011-06-29 21:32:02 +02:00
Jordi Boggiano
38862439a0 Improved coverage of Logger 2011-06-29 18:58:56 +02:00
Jordi Boggiano
a426ce2815 Added a Processor stack to the Logger class, added getHandler() to check if any handler is going to handle the message before processing it, handlers are now calling their parent in a chain 2011-02-21 20:38:18 +01:00
Jordi Boggiano
3fa6e4b91f Major refactoring to follow the Logbook model 2011-02-20 20:53:11 +01:00
Jordi Boggiano
7239b5203b Added tests, fixed a bunch of bugs 2011-02-17 03:04:37 +01:00