当前位置: 首页>>代码示例>>PHP>>正文


PHP L::log方法代码示例

本文整理汇总了PHP中L::log方法的典型用法代码示例。如果您正苦于以下问题:PHP L::log方法的具体用法?PHP L::log怎么用?PHP L::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在L的用法示例。


在下文中一共展示了L::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadCompiled

 /**
  * @return Unpacker|NULL
  */
 protected function loadCompiled($filename)
 {
     $basename = basename($filename, '.xoup');
     $class = 'XOUP' . $basename . 'Unpacker';
     if (!class_exists($class, false)) {
         $dirname = dirname($filename);
         $compiled_name = $dirname . '/' . $basename . '.php';
         if (file_exists($dirname . '/' . $basename . '.php')) {
             $source_ts = filemtime($filename);
             $compiled_ts = filemtime($compiled_name);
             if ($compiled_ts < $source_ts) {
                 L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'source modified since last compilation', array());
                 return null;
             }
             require_once $compiled_name;
             if (!class_exists($class)) {
                 throw new RuntimeException("{$class} not present in {$compiled_name}");
             }
             L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'loaded compiled XOUP class %s from file %s', array($class, $compiled_name));
         } else {
             // no compiled file exists
             L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'compiled XOUP file %s does not (yet) exist', array($compiled_name));
             return null;
         }
     }
     return new $class();
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:30,代码来源:XoupLoader.php

示例2: addPluginsTo

 public function addPluginsTo(SSLPluggable $sslpluggable)
 {
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, "yielding %d plugins", array(count($this->plugins)));
     foreach ($this->plugins as $plugin) {
         $sslpluggable->addPlugin($plugin);
     }
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:7,代码来源:CLIIrcCatPlugin.php

示例3: trackStopped

 protected function trackStopped(SSLTrack $track)
 {
     $stm = $this->factory->newScrobblerTrackModel($track);
     if ($stm->isScrobblable()) {
         L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'I reckon it\'s time to submit a scrobble for %s!', array($track->getFullTitle()));
         $this->notifyScrobbleObservers($track);
     }
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:8,代码来源:ScrobbleModel.php

示例4: handle

 protected function handle($signal)
 {
     switch ($signal) {
         case SIGINT:
             L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'Caught SIGINT', array());
             $this->should_exit = true;
             break;
     }
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:9,代码来源:SignalHandler.php

示例5: dump

 public function dump()
 {
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'reading structure of %s...', array($this->filename));
     $tree = $this->read($this->filename);
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'asking structure DOM to parse %s...', array($this->filename));
     // Without this line you'll just get hexdumps, which is not very exciting.
     $tree->getData();
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'printing structure of %s...', array($this->filename));
     // After the parsing has occurred, we get much more exciting debug output.
     $tree->display();
     echo "Memory usage: " . number_format(memory_get_peak_usage()) . " bytes\n";
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:12,代码来源:SSLFileReader.php

示例6: getChunks

 public function getChunks()
 {
     $chunks = array();
     do {
         $chunk = $this->readChunk();
         if ($chunk !== false) {
             $chunks[] = $chunk;
         }
     } while ($chunk !== false);
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, "Read %d chunks", array(count($chunks)));
     return $chunks;
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:12,代码来源:SSLChunkReader.php

示例7: checkForNewFilename

 protected function checkForNewFilename()
 {
     if (isset($this->fns)) {
         $old_filename = $this->filename;
         $this->filename = $this->fns->getNewFilename();
         $got_new_file = $this->filename != $old_filename;
         if ($got_new_file) {
             L::level(L::INFO) && L::log(L::INFO, __CLASS__, "Changed to new file %s", array($this->filename));
         }
         return $got_new_file;
     }
     return false;
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:13,代码来源:DiffMonitor.php

示例8: addPlugin

 /**
  * Enable a plugin.
  * 
  * HistoryReader calls this indirectly when it asks CLIPlugins to add their
  * SSLPlugins to the plugin chain.
  * 
  * @param SSLPlugin $plugin
  */
 public function addPlugin(SSLPlugin $plugin)
 {
     // onSetup for late added plugins
     if ($this->setup_done) {
         $plugin->onSetup();
     }
     // onStart for late added plugins
     if ($this->clock_is_ticking) {
         $plugin->onStart();
     }
     $this->plugin_wrapper->addPlugin($this->max_plugin_id, $plugin);
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, "added %s plugin with id %d", array(get_class($plugin), $this->max_plugin_id));
     $this->max_plugin_id++;
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:22,代码来源:PluginManager.php

示例9: getData

 /**
  * @return array of SSLOtrkChunk
  */
 public function getData()
 {
     $data = array();
     $chunk_count = 0;
     foreach ($this as $chunk) {
         if ($chunk instanceof SSLOtrkChunk) {
             $data[] = $chunk->getDataInto(new SSLLibraryTrack());
         } elseif ($chunk instanceof SSLVrsnChunk) {
             $data[] = $chunk->getDataInto(new SSLVersion());
         }
         $chunk_count++;
         L::level(L::DEBUG) && !($chunk_count % 1000) && L::log(L::DEBUG, __CLASS__, "Parsed %d chunks...", array($chunk_count));
     }
     return $data;
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:18,代码来源:SSLLibraryDom.php

示例10: shorten

 public function shorten($url)
 {
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, "Shortening %s", array($url));
     $result = vgdShorten($url, null, true);
     // log stats
     if ($result['shortURL']) {
         L::level(L::INFO) && L::log(L::INFO, __CLASS__, "Shortened to %s", array($result['shortURL']));
         return $result['shortURL'];
     }
     L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, "Shorten failed: %s", array($result['errorMessage']));
     // On failure we return empty rather than the original URL
     // on the assumption that it was too long in the first place
     //return $url;
     return '';
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:15,代码来源:VgdURLShortener.php

示例11: notifyNowPlaying

 public function notifyNowPlaying(SSLTrack $track = null)
 {
     if (!$track) {
         return;
     }
     $sock = fsockopen($this->host, $this->port, $errno, $errstr, $timeout = 1);
     if ($sock === false) {
         L::level(L::ERROR) && L::log(L::ERROR, __CLASS__, "couldn't connect to IRCCat: (%d) %s", array($errno, $errstr));
         return;
     }
     $message = sprintf($this->config['message'], $track->getFullTitle());
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, "sending '%s' -> %s:%d#%s", array($message, $this->host, $this->port, $this->channel));
     fwrite($sock, sprintf("%s %s", $this->channel, $message));
     fclose($sock);
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:15,代码来源:IrcCatPlugin.php

示例12: notifyScrobble

 public function notifyScrobble(SSLTrack $track)
 {
     $length = $track->getLengthInSeconds(SSLTrack::TRY_HARD);
     if ($length == 0) {
         // Perhaps this entry was added manually.
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Could not guess length. Last.fm will silently ignore the scrobble.', array());
     }
     try {
         $this->scrobbler->add($track->getArtist(), $track->getTitle(), $track->getAlbum(), $length, $track->getStartTime());
         L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'Sending %d scrobble(s) to Last.fm', array($this->scrobbler->getQueueSize()));
         $this->scrobbler->submit();
         // TODO: caching if scrobbling's down whilst playing.
     } catch (Exception $e) {
         L::level(L::WARNING) && L::log(L::WARNING, __CLASS__, 'Could not send %d scrobble(s) to Last.fm: %s', array($this->scrobbler->getQueueSize(), $e->getMessage()));
     }
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:16,代码来源:SSLScrobblerAdaptor.php

示例13: compile

 public function compile($filename)
 {
     L::level(L::INFO) && L::log(L::INFO, __CLASS__, 'compiling %s', array($filename));
     $class = $this->getClassName($filename);
     $output = "<?php\n\n";
     $output .= "/* Autogenerated by XoupCompiler */\n\n";
     $output .= "class {$class} extends Unpacker\n{\n\n";
     $output .= "    private \$out_buffer = '';\n";
     $output .= "    private \$context = array();\n";
     if (!empty($this->data)) {
         $output .= "    private \$data = array(\n";
         foreach ($this->data as $k => $v) {
             $k = addslashes($k);
             $v = addslashes($v);
             $output .= "        \"{$k}\" => \"{$v}\",\n";
         }
         $output .= "    );\n";
     }
     $output .= "\n";
     $output .= "    public function unpack(\$bin)\n";
     $output .= "    {\n";
     $output .= "        \$binlen = strlen(\$bin);\n";
     $output .= "        \$acc = 0;\n";
     $output .= "        \$ptr = 0;\n";
     $output .= "        \$this->_main(\$bin, \$binlen, \$acc, \$ptr);\n";
     $output .= "        return \$this->context;\n";
     $output .= "    }\n\n";
     $output .= "    public function flushBuffer()\n";
     $output .= "    {\n";
     $output .= "        L::level(L::INFO) &&\n";
     $output .= "            L::log(L::INFO, __CLASS__, \$this->out_buffer,\n";
     $output .= "                array());\n";
     $output .= "    }\n\n";
     foreach (array_keys($this->subs) as $sub) {
         $output .= $this->writeFunctionHeader($sub);
         $output .= $this->writeFunctionBody($sub);
         $output .= $this->writeFunctionFooter();
     }
     $output .= $this->writeLUTFunctionHeader();
     $output .= $this->writeLUTFunctionBody(array_keys($this->subs));
     $output .= $this->writeFunctionFooter();
     $output .= "}\n";
     file_put_contents($this->getCompiledName($filename), $output);
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:44,代码来源:XoupCompiler.php

示例14: elapse

 public function elapse($seconds)
 {
     $this->playtime += $seconds;
     $was_passed_now_playing_point = $this->passed_now_playing_point;
     $was_passed_scrobble_point = $this->passed_scrobble_point;
     $was_ended = $this->passed_end;
     $this->passed_now_playing_point = $this->playtime >= self::NOW_PLAYING_MIN;
     $this->passed_scrobble_point = $this->playtime >= $this->scrobble_point;
     $this->passed_end = $this->playtime >= $this->end_point;
     if ($this->passed_now_playing_point && !$was_passed_now_playing_point) {
         L::level(L::INFO) && L::log(L::INFO, __CLASS__, '%s passed now playing point', array($this->track->getFullTitle()));
     }
     if ($this->passed_scrobble_point && !$was_passed_scrobble_point) {
         L::level(L::INFO) && L::log(L::INFO, __CLASS__, '%s passed scrobble point', array($this->track->getFullTitle()));
     }
     if ($this->passed_end && !$was_ended) {
         L::level(L::INFO) && L::log(L::INFO, __CLASS__, '%s passed end point', array($this->track->getFullTitle()));
     }
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:19,代码来源:ScrobblerTrackModel.php

示例15: parse

 public function parse($program)
 {
     $data = array();
     // strip comments
     $stripped_program = preg_replace("/#[^\n]*\n/", ' ', $program);
     // tokenize
     $ops = preg_split("/\\s+/", $stripped_program);
     // trim
     $ops = array_map('trim', $ops);
     // remove empty tokens
     foreach ($ops as $k => $v) {
         if (empty($v)) {
             unset($ops[$k]);
         }
     }
     $subs = array();
     $opdest = null;
     foreach ($ops as $k => $v) {
         if (preg_match('/^([a-zA-Z0-9]+):$/', $v, $matches)) {
             // it's a label
             $subs[$matches[1]] = array();
             $opdest = $matches[1];
         } elseif (preg_match('/^\\.[a-zA-Z0-9]+$/', $v, $matches)) {
             // we found our first piece of DATA. finish program parsing
             // and move to DATA parsing
             $data = $this->parseData($program);
             break;
         } else {
             // it's an op
             if (is_null($opdest)) {
                 throw new RuntimeException("Parse error: op found out of sub scope");
             }
             $subs[$opdest][] = $v;
         }
     }
     if (!in_array('main', array_keys($subs))) {
         throw new RuntimeException("Parse error: no 'main' sub found.");
     }
     L::level(L::DEBUG) && L::log(L::DEBUG, __CLASS__, 'parsed %d subs and %d literals', array(count($subs), count($this->data)));
     return $subs;
 }
开发者ID:rabyunghwa,项目名称:sslscrobbler,代码行数:41,代码来源:XoupParser.php


注:本文中的L::log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。