1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-26 09:04:26 +02:00

even more testing

This commit is contained in:
Mikael Roos
2016-08-08 11:19:53 +02:00
parent 493ed45311
commit 689865a8b2
10 changed files with 56 additions and 29 deletions

View File

@@ -43,12 +43,6 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
// For CRemoteImage
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
// Change to true to enable debug mode which logs additional information
// to file. Only use for test and development.
define("CIMAGE_DEBUG", true);
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
//define("CIMAGE_DEBUG", false);
/**
@@ -68,10 +62,11 @@ function trace($msg)
{
$file = CIMAGE_DEBUG_FILE;
if (!is_writable($file)) {
die("Using trace without a writable logfile. Create the file '$file' and make it writable for the web server.");
return;
}
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
$details = "{$timer}ms";
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
$details .= ":" . count(get_included_files());
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
@@ -4316,6 +4311,11 @@ if (is_file($configFile)) {
$config = array();
}
// Make CIMAGE_DEBUG false by default, if not already defined
if (!defined("CIMAGE_DEBUG")) {
define("CIMAGE_DEBUG", false);
}
/**