PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/opcache - zend_accelerator_debug.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 4 36 11.1 %
Date: 2014-08-04 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend OPcache                                                         |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2014 The PHP Group                                |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 3.01 of the PHP license,      |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.php.net/license/3_01.txt                                  |
      11             :    | If you did not receive a copy of the PHP license and are unable to   |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@php.net so we can mail you a copy immediately.               |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16             :    |          Zeev Suraski <zeev@zend.com>                                |
      17             :    |          Stanislav Malyshev <stas@zend.com>                          |
      18             :    |          Dmitry Stogov <dmitry@zend.com>                             |
      19             :    +----------------------------------------------------------------------+
      20             : */
      21             : 
      22             : #include <stdio.h>
      23             : #include <stdlib.h>
      24             : #include <stdarg.h>
      25             : #include <time.h>
      26             : #ifdef ZEND_WIN32
      27             : # include <process.h>
      28             : #endif
      29             : #include "ZendAccelerator.h"
      30             : 
      31         442 : void zend_accel_error(int type, const char *format, ...)
      32             : {
      33             :     va_list args;
      34             :         time_t timestamp;
      35             :         char *time_string;
      36         442 :         FILE * fLog = NULL;
      37             :         TSRMLS_FETCH();
      38             : 
      39         442 :         if (type > ZCG(accel_directives).log_verbosity_level) {
      40         442 :                 return;
      41             :         }
      42             : 
      43           0 :         timestamp = time(NULL);
      44           0 :         time_string = asctime(localtime(&timestamp));
      45           0 :         time_string[24] = 0;
      46             : 
      47           0 :         if (!ZCG(accel_directives).error_log ||
      48           0 :             !*ZCG(accel_directives).error_log ||
      49           0 :             strcmp(ZCG(accel_directives).error_log, "stderr") == 0) {
      50             : 
      51           0 :                 fLog = stderr;
      52             :         } else {
      53           0 :                 fLog = fopen(ZCG(accel_directives).error_log, "a+");
      54           0 :                 if (!fLog) {
      55           0 :                         fLog = stderr;
      56             :                 }
      57             :         }
      58             : 
      59             : #ifdef ZTS
      60             :     fprintf(fLog, "%s (%lu): ", time_string, (unsigned long)tsrm_thread_id());
      61             : #else
      62           0 :     fprintf(fLog, "%s (%d): ", time_string, getpid());
      63             : #endif
      64             : 
      65           0 :         switch (type) {
      66             :                 case ACCEL_LOG_FATAL:
      67           0 :                         fprintf(fLog, "Fatal Error ");
      68           0 :                         break;
      69             :                 case ACCEL_LOG_ERROR:
      70           0 :                         fprintf(fLog, "Error ");
      71           0 :                         break;
      72             :                 case ACCEL_LOG_WARNING:
      73           0 :                         fprintf(fLog, "Warning ");
      74           0 :                         break;
      75             :                 case ACCEL_LOG_INFO:
      76           0 :                         fprintf(fLog, "Message ");
      77           0 :                         break;
      78             :                 case ACCEL_LOG_DEBUG:
      79           0 :                         fprintf(fLog, "Debug ");
      80             :                         break;
      81             :         }
      82             : 
      83           0 :     va_start(args, format);
      84           0 :     vfprintf(fLog, format, args);
      85           0 :     va_end(args);
      86           0 :         fprintf(fLog, "\n");
      87           0 :         switch (type) {
      88             :                 case ACCEL_LOG_ERROR:
      89           0 :                         zend_bailout();
      90           0 :                         break;
      91             :                 case ACCEL_LOG_FATAL:
      92           0 :                         exit(-2);
      93             :                         break;
      94             :         }
      95           0 :         fflush(fLog);
      96           0 :         if (fLog != stderr) {
      97           0 :                 fclose(fLog);
      98             :         }
      99             : }

Generated by: LCOV version 1.10

Generated at Mon, 04 Aug 2014 15:49:08 +0000 (27 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.