Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Logger.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\swiftmailer;
  8. use Yii;
  9. /**
  10. * Logger is a SwiftMailer plugin, which allows passing of the SwiftMailer internal logs to the
  11. * Yii logging mechanism. Each native SwiftMailer log message will be converted into Yii 'info' log entry.
  12. *
  13. * In order to catch logs written by this class, you need to setup a log route for 'yii\swiftmailer\Logger::add' category.
  14. * For example:
  15. *
  16. * ~~~
  17. * 'log' => [
  18. * 'targets' => [
  19. * [
  20. * 'class' => 'yii\log\FileTarget',
  21. * 'categories' => ['yii\swiftmailer\Logger::add'],
  22. * ],
  23. * ],
  24. * ],
  25. * ~~~
  26. *
  27. * @author Paul Klimov <klimov.paul@gmail.com>
  28. * @since 2.0
  29. */
  30. class Logger implements \Swift_Plugins_Logger
  31. {
  32. /**
  33. * @inheritdoc
  34. */
  35. public function add($entry)
  36. {
  37. Yii::info($entry, __METHOD__);
  38. }
  39. /**
  40. * @inheritdoc
  41. */
  42. public function clear()
  43. {
  44. // do nothing
  45. }
  46. /**
  47. * @inheritdoc
  48. */
  49. public function dump()
  50. {
  51. return '';
  52. }
  53. }