You are here

function hosting_task_log in Hostmaster (Aegir) 6

Insert an entry in the task log.

Parameters

$vid: The vid of the task to add an entry for.

$type: The type of log entry being added.

$message: The message for this log entry.

$error: (optional) The error code associated to this log entry.

$timestamp: (optional) The UNIX timestamp of this log message, this defaults to the current time.

4 calls to hosting_task_log()
hosting_migrate_platform_submit_batch in modules/hosting/migrate/hosting_migrate.batch.inc
Batch callback for platform migration submission.
hosting_task_cancel in modules/hosting/task/hosting_task.module
hosting_task_retry in modules/hosting/task/hosting_task.module
Retry the given task
_hosting_task_log in modules/hosting/task.hosting.inc
Log a message to the current task's node if possible, the screen otherwise.
2 string references to 'hosting_task_log'
hosting_task_update_6005 in modules/hosting/task/hosting_task.install
Remove DEFAULT value on a LONGTEXT fields.
hosting_task_update_6006 in modules/hosting/task/hosting_task.install
Add nid field to hosting_task_log and remove orphaned log entries.

File

modules/hosting/task/hosting_task.module, line 314
Web server node type is defined here.

Code

function hosting_task_log($vid, $type, $message, $error = '', $timestamp = NULL) {

  // We keep track of nids we've looked up in this request, for faster lookups.
  static $nids = array();
  $timestamp = $timestamp ? $timestamp : time();

  // We need to insert the nid in addition to the vid, so look it up.
  if (!isset($nids[$vid])) {
    $nids[$vid] = (int) db_result(db_query('SELECT nid FROM {hosting_task} WHERE vid = %d', $vid));
  }
  db_query("INSERT INTO {hosting_task_log} (vid, nid, type, message, error, timestamp) VALUES (%d, %d, '%s', '%s', '%s', %d)", $vid, $nids[$vid], $type, $message, $error, $timestamp);
}