Merge pull request #4372 from davecivicrm/CRM-15467
[civicrm-core.git] / CRM / Utils / SystemLogger.php
index df2a25d752aebf2c9eb08219e3eae44bf43aaa70..57b9eb2a1988ca937e615123830945f0268d9cee 100644 (file)
  *
  */
 class CRM_Utils_SystemLogger extends Psr\Log\AbstractLogger implements \Psr\Log\LoggerInterface {
+  /**
+   * Logs with an arbitrary level.
+   *
+   * @param mixed $level
+   * @param string $message
+   * @param array $context
+   * @return null
+   */
+  /**
+   * @param mixed $level
+   * @param string $message
+   * @param array $context
+   *
+   * @return null
+   */
   public function log($level, $message, array $context = array()) {
+    if(!isset($context['hostname'])) {
+      $context['hostname'] = CRM_Utils_System::ipAddress();
+    }
     $rec = new CRM_Core_DAO_SystemLog();
     $separateFields = array('contact_id', 'hostname');
     foreach ($separateFields as $separateField) {