Create a new logbook entry

@param int $objectID Object identifier
@param string $message Message
@param string $description (optional) Description

@return self Returns itself

@throws Exception on error
776907
public function create($objectID, $message, $description = null) {
        $params = [
            'object_id' => $objectID,
            'message' => $message
        ];

        if (isset($description)) {
            $params['description'] = $description;
        }

        $result = $this->api->request(
            'cmdb.logbook.create',
            $params
        );

        if (!array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return $this;
    }
786212
public void logDescription(String description) throws IOException
   {
      // The ThreadLocal has been initialized so we know that we are in multithreaded mode.
      if (reportContext.get() != null)
      {
         reportContext.get().addComment(description);
      }
      else
      {
         writeMessage(description);
      }
   }
642545
public function updateRecord($documentId, $entity, $returnEntity = true)
    {
        if (!is_null($documentId)) {
            $this->deleteById($documentId);
            // detach so odm knows it's gone
            $this->manager->detach($entity);
            $this->manager->clear();
        }

        $entity = $this->manager->merge($entity);

        $this->manager->persist($entity);
        $this->manager->flush($entity);
        $this->manager->detach($entity);

        // Fire ModelEvent
        $this->dispatchModelEvent(ModelEvent::MODEL_EVENT_UPDATE, $entity);

        if ($returnEntity) {
            return $entity;
        }
        return null;
    }
425476
public function log(Message $message, \Exception $e)
    {
        $sql = "UPDATE " . $this->messageTable . "
                SET log = :log
                WHERE message_id = :id
        ";
        $stmt = $this->getDb()->prepare($sql);
        $stmt->bindValue(':log', $e->getMessage(), \PDO::PARAM_STR);
        $stmt->bindValue(':id', $message->message_id, \PDO::PARAM_INT);
        $stmt->execute();
    }
940848
public function createFailure(string $description)
    {
        $exception = new AssertionException($description);

        $suiteClass = $this->suiteClass;
        $suiteClass::current()->assert([
            'handler' => function () use ($exception) {
                throw $exception;
            },
            'type' => AssertionException::class,
        ]);
    }
295876
public function create($objectID, $categoryConst, array $attributes) {
        $params = [
            'objID' => $objectID,
            'data' => $attributes,
            'category' => $categoryConst
        ];

        $result = $this->api->request(
            'cmdb.category.create',
            $params
        );

        if (!array_key_exists('id', $result) ||
            !is_numeric($result['id']) ||
            !array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return (int) $result['id'];
    }
276870
public long writeLogRecord(LogRecord logRecord)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "writeLogRecord"
                            );

        long logSequenceNumber = objectManagerState.logOutput.writeNext(logRecord
                                                                        , 0
                                                                        , true
                                                                        , false
                        );

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "writeLogRecord"
                       , "returns logSequenceNumber=" + logSequenceNumber + "(long)"
                            );
        return logSequenceNumber;
    }
300241
public function emergency($message, array $context = array())
    {
        try
        {
            return $this->logger->emergency($message, $context);
        }
        catch (Error $ex)
        {}
        catch (Exception $ex)
        {}

        throw new WriteException("Record with debug level could not be logged.", 0, $ex);
    }
1181289
protected function log(
        $message, $source = null, $level = E_NOTICE, $data = null
    )
    {
        if (!($this->evtManager instanceof Manager)) {
            $e = new ExceptionExtended(sprintf(
                "%s::\$evtManager isn't instance of %s",
                get_class($this), Manager::class
            ));
            $e->setData($data);
            throw $e;
        }
        if (is_null($source)) {
            $source = ":missed:";
        }
        $args = new Args([
            'message' => $message,
            'source'  => $source,
            'level'   => (int)$level,
        ]);
        $this->evtManager->fire(':log:', $args);
    }
697981
public function createChildEvent(Message $message): self
    {
        if (!$this->supportsRecursion()) {
            throw new \LogicException(sprintf('%s does not support recursion.', get_called_class()));
        }

        $event = new static($message);
        $event->depth = $this->depth + 1;
        $event->parentEvent = $this;
        return $event;
    }
940614
public function logException(Exception $exception, $message = null)
    {
        $msg = $exception->getMessage();
        if ($message != null) {
            $msg = "Message: " . $message . " Exception: " . $msg;
        }
        $this->doLog(LogHelper::LOG_LEVEL_FATAL, $msg, null);
    }
310514
public static function handle($file, $line, $expression, $description)
    {
        throw new self($file, $line, $expression, $description);
    }
898901
public function add($objectID, $filePath, $caption = '') {
        $imageAsString = $this->encode($filePath);

        $cmdbCategory = new CMDBCategory($this->api);

        $cmdbCategory->create(
            $objectID,
            'C__CATG__IMAGES',
            [
                'name' => $caption,
                'content' => $imageAsString
            ]
        );

        return $this;
    }
850494
protected function generateLog($level, $message, $object = '', $enforceEndOfLine = true)
    {
        $now = date('Y-m-d H:i:s');
        $level_string = "[{$level}]";

        $log = "{$now} {$level_string} ";
        if ($this->showProcessID) {
            $log .= "PID: " . getmypid() . " ";
        }
        $log .= "{$message} |";
        $log .= is_string($object) ? $object : json_encode($object, JSON_UNESCAPED_UNICODE);
        if ($enforceEndOfLine) $log .= PHP_EOL;

        return $log;
    }
683765
final public function logEvent($description, $type='notice', $subtext=NULL) {
		
		$logger = Logger::getInstance();
		$logger->addEvent($description, $type, $subtext);
		
	}
1211299
@SuppressWarnings("unchecked")
	public <T extends Message> Map<String, Object> writeMessage(final T message,
			final MessageDescriptor<T> descriptor) {
		try {
			return (Map<String, Object>) objectFormat.write(message, descriptor);
		} catch (Exception e) {
			throw propagate(e);
		}
	}
1347303
protected function copyNode(ObjectId $oid) {
    $logger = $this->getLogger();
    if ($logger->isDebugEnabled()) {
      $logger->debug("Copying node ".$oid);
    }
    $persistenceFacade = $this->getPersistenceFacade();

    // load the original node
    $node = $persistenceFacade->load($oid);
    if ($node == null) {
      throw new PersistenceException("Can't load node '".$oid."'");
    }

    // check if we already have a copy of the node
    $nodeCopy = $this->getCopy($node->getOID());
    if ($nodeCopy == null) {
      // if not, create it
      $nodeCopy = $persistenceFacade->create($node->getType());
      $node->copyValues($nodeCopy, false);
    }

    // save copy
    $this->registerCopy($node, $nodeCopy);

    if ($logger->isInfoEnabled()) {
      $logger->info("Copied: ".$node->getOID()." to ".$nodeCopy->getOID());
    }
    if ($logger->isDebugEnabled()) {
      $logger->debug($nodeCopy->__toString());
    }

    // create the connections to already copied relatives
    // this must be done after saving the node in order to have a correct oid
    $mapper = $node->getMapper();
    $relations = $mapper->getRelations();
    foreach ($relations as $relation) {
      if ($relation->getOtherNavigability()) {
        $otherRole = $relation->getOtherRole();
        $relativeValue = $node->getValue($otherRole);
        $relatives = $relation->isMultiValued() ? $relativeValue :
                ($relativeValue != null ? [$relativeValue] : []);
        foreach ($relatives as $relative) {
          $copiedRelative = $this->getCopy($relative->getOID());
          if ($copiedRelative != null) {
            $nodeCopy->addNode($copiedRelative, $otherRole);
            if ($logger->isDebugEnabled()) {
              $logger->debug("Added ".$copiedRelative->getOID()." to ".$nodeCopy->getOID());
              $logger->debug($copiedRelative->__toString());
            }
          }
        }
      }
    }
    return $nodeCopy;
  }