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: 2015-06-27 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend OPcache                                                         |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2015 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         447 : void zend_accel_error(int type, const char *format, ...)
      32             : {
      33             :     va_list args;
      34             :         time_t timestamp;
      35             :         char *time_string;
      36         447 :         FILE * fLog = NULL;
      37             : 
      38         447 :         if (type > ZCG(accel_directives).log_verbosity_level) {
      39         447 :                 return;
      40             :         }
      41             : 
      42           0 :         timestamp = time(NULL);
      43           0 :         time_string = asctime(localtime(&timestamp));
      44           0 :         time_string[24] = 0;
      45             : 
      46           0 :         if (!ZCG(accel_directives).error_log ||
      47           0 :             !*ZCG(accel_directives).error_log ||
      48           0 :             strcmp(ZCG(accel_directives).error_log, "stderr") == 0) {
      49             : 
      50           0 :                 fLog = stderr;
      51             :         } else {
      52           0 :                 fLog = fopen(ZCG(accel_directives).error_log, "a+");
      53           0 :                 if (!fLog) {
      54           0 :                         fLog = stderr;
      55             :                 }
      56             :         }
      57             : 
      58             : #ifdef ZTS
      59             :     fprintf(fLog, "%s (" ZEND_ULONG_FMT "): ", time_string, (zend_ulong)tsrm_thread_id());
      60             : #else
      61           0 :     fprintf(fLog, "%s (%d): ", time_string, getpid());
      62             : #endif
      63             : 
      64           0 :         switch (type) {
      65             :                 case ACCEL_LOG_FATAL:
      66           0 :                         fprintf(fLog, "Fatal Error ");
      67           0 :                         break;
      68             :                 case ACCEL_LOG_ERROR:
      69           0 :                         fprintf(fLog, "Error ");
      70           0 :                         break;
      71             :                 case ACCEL_LOG_WARNING:
      72           0 :                         fprintf(fLog, "Warning ");
      73           0 :                         break;
      74             :                 case ACCEL_LOG_INFO:
      75           0 :                         fprintf(fLog, "Message ");
      76           0 :                         break;
      77             :                 case ACCEL_LOG_DEBUG:
      78           0 :                         fprintf(fLog, "Debug ");
      79             :                         break;
      80             :         }
      81             : 
      82           0 :     va_start(args, format);
      83           0 :     vfprintf(fLog, format, args);
      84           0 :     va_end(args);
      85           0 :         fprintf(fLog, "\n");
      86           0 :         switch (type) {
      87             :                 case ACCEL_LOG_ERROR:
      88           0 :                         zend_bailout();
      89           0 :                         break;
      90             :                 case ACCEL_LOG_FATAL:
      91           0 :                         exit(-2);
      92             :                         break;
      93             :         }
      94           0 :         fflush(fLog);
      95           0 :         if (fLog != stderr) {
      96           0 :                 fclose(fLog);
      97             :         }
      98             : }

Generated by: LCOV version 1.10

Generated at Sat, 27 Jun 2015 09:41:14 +0000 (8 days ago)

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