Cachearium\CacheAbstract::log PHP Method

log() protected method

Logs cache accesses for debugging
protected log ( string $status, CacheKey $k, integer $lifetime )
$status string CacheLogEnum constant
$k CacheKey The message to print.
$lifetime integer
    protected function log($status, CacheKey $k, $lifetime = 0)
    {
        static::$summary[$status]++;
        if ($this->should_log == false) {
            return;
        }
        $bt = debug_backtrace();
        foreach ($bt as $i => $d) {
            if (strpos($d['file'], '/Cache') === false) {
                // TODO: if() may not work well if user has a file called Cache
                $trace = $d['function'] . ' at ' . $d['file'] . ':' . $d['line'];
                $this->cache_log[] = array('status' => $status, 'message' => "(" . $k->debug() . ", {$lifetime}) by " . $trace);
                break;
            }
        }
    }