/[drupal]/contributions/modules/trace/drivers/file.inc
ViewVC logotype

Contents of /contributions/modules/trace/drivers/file.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Mon Jul 7 16:16:14 2008 UTC (16 months, 2 weeks ago) by incanus
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, DRUPAL-6--1-0-ALPHA2, DRUPAL-6--1-0-ALPHA1, HEAD
Changes since 1.2: +1 -1 lines
File MIME type: text/x-php
Imported 6.x branch from SVN development repository.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Output driver for writing trace messages into a text file.
7 */
8
9 //////////////////////////////////////////////////////////////////////////////
10
11 /**
12 * Implements hook_trace().
13 */
14 function trace_file_trace($type, $msg, $time = NULL) {
15 $type = sprintf('%-7s', strtoupper($type));
16 $time = _trace_format_timedelta($time);
17 $header = sprintf(TRACE_FORMAT, TRACE_ID, $time, $type) . ' ';
18
19 if (!is_array($msg)) {
20 $output = $header . $msg;
21 }
22 else {
23 $output = array($header . array_shift($msg));
24 foreach ($msg as $line) {
25 $output[] = str_repeat(' ', strlen($header)) . $line;
26 }
27 $output = implode("\n", $output);
28 }
29
30 if (($file = fopen(TRACE_FILE, 'ab'))) {
31 fwrite($file, $output . "\n");
32 fclose($file);
33 }
34 }
35
36 //////////////////////////////////////////////////////////////////////////////

  ViewVC Help
Powered by ViewVC 1.1.2