You are here

function hosting_task_log in Hosting 6.2

Same name and namespace in other branches
  1. 5 task/hosting_task.module \hosting_task_log()
  2. 7.4 task/hosting_task.module \hosting_task_log()
  3. 7.3 task/hosting_task.module \hosting_task_log()

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 migrate/hosting_migrate.batch.inc
Batch callback for platform migration submission.
hosting_task_cancel in task/hosting_task.module
hosting_task_retry in task/hosting_task.module
Retry the given task
_hosting_task_log in ./task.hosting.inc
Log a message to the current task's node if possible, the screen otherwise.
3 string references to 'hosting_task_log'
hosting_task_update_6005 in task/hosting_task.install
Remove DEFAULT value on a LONGTEXT fields.
hosting_task_update_6006 in task/hosting_task.install
Add nid field to hosting_task_log and remove orphaned log entries.
hosting_task_views_default_views in task/hosting_task.views_default.inc
Implementation of hook_views_default_views().

File

task/hosting_task.module, line 333
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);
}