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


PHP Daemon::log方法代码示例

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


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

示例1: onFileChanged

 public function onFileChanged($path)
 {
     if (!Daemon::lintFile($path)) {
         Daemon::log(__METHOD__ . ': Detected parse error in ' . $path);
         return;
     }
     foreach ($this->files[$path] as $k => $subscriber) {
         if (is_callable($subscriber) || is_array($subscriber)) {
             call_user_func($subscriber, $path);
             continue;
         }
         if (!isset(Daemon::$process->workers->threads[$subscriber])) {
             unset($this->files[$path][$k]);
             continue;
         }
         $worker = Daemon::$process->workers->threads[$subscriber];
         if (Daemon::$config->autoreimport->value) {
             if ($worker->connection) {
                 $worker->connection->sendPacket(array('op' => 'importFile', 'path' => $path));
             }
         } else {
             $worker->signal(SIGUSR2);
         }
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:25,代码来源:FileWatcher.php

示例2: onReady

 /**
  * Called when the worker is ready to go
  * 
  * @return void
  */
 public function onReady()
 {
     // Adding listener
     // ComplexJob - STATE_WAITING
     $job = new ComplexJob(function ($job) {
         // ComplexJob - STATE_DONE
         /*array (
             'bar' =>
             array (
                   'job' => 'bar',
                   'success' => false,
                   'line' => 63,
             ),
             'foo' =>
             array (
                   'job' => 'foo',
                   'success' => true,
                   'line' => 84,
                   'arg' =>
                   array (
                     'param' => 'value',
                   ),
             ),
             'baz' =>
             array (
                   'job' => 'baz',
                   'success' => false,
                   'line' => 94,
             ),
           )*/
         Daemon::log($job->results);
     });
     // Adding listener
     // ComplexJob - STATE_WAITING
     $job->addListener(function ($job) {
         // ComplexJob - STATE_DONE
     });
     // Incapsulate some property in job
     $job->appInstance = $this;
     // Adding async job foo
     $job('foo', $this->foo(array('param' => 'value')));
     // Adding with 1 sec delay
     Timer::add(function ($event) use($job) {
         // Adding async job bar
         $job('bar', function ($jobname, $job) {
             Timer::add(function ($event) use($jobname, $job) {
                 // Job done
                 $job->setResult($jobname, array('job' => 'bar', 'success' => false, 'line' => __LINE__));
                 $event->finish();
             }, 1000.0 * 50);
         });
         // Adding async job baz. Equal $job('baz', $job->appInstance->baz());
         $job->addJob('baz', $job->appInstance->baz());
         // Run jobs. All listeners will be called when the jobs done
         // ComplexJob - STATE_RUNNING
         $job();
         $event->finish();
     }, 1000000.0 * 1);
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:64,代码来源:ExampleComplexJob.php

示例3: onFrame

 /**
  * Called when new frame received.
  * @param string Frame's contents.
  * @param integer Frame's type.
  * @return void
  */
 public function onFrame($data, $type)
 {
     if ($data === 'ping') {
         $this->client->sendFrame('pong', WebSocketSERVER::STRING, function ($client) {
             Daemon::log('ExampleWebSocket: \'pong\' received by client.');
         });
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:14,代码来源:ExampleWebSocket.php

示例4: stdin

 public function stdin($buf)
 {
     // from mysqld to client.
     if (Daemon::$settings['mod' . $this->appInstance->modname . 'protologging']) {
         Daemon::log('MysqlProxy: Server --> Client: ' . Daemon::exportBytes($buf) . "\n\n");
     }
     $this->downstream->write($buf);
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:8,代码来源:MySQLProxy.php

示例5: stdin

 /**
  * Called when new data received
  * @param string New data
  * @return void
  */
 public function stdin($buf)
 {
     Daemon::log(Debug::exportBytes($buf));
     while ($c = array_pop($this->callbacks)) {
         list($cb, $st) = $c;
         $cb(microtime(true) - $st);
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:13,代码来源:PingClient.php

示例6: init

 public function init()
 {
     Daemon::$settings += array('mod' . $this->modname . 'listen' => 'tcp://0.0.0.0', 'mod' . $this->modname . 'listenport' => 23, 'mod' . $this->modname . 'enable' => 0);
     if (Daemon::$settings['mod' . $this->modname . 'enable']) {
         Daemon::log(__CLASS__ . ' up.');
         $this->bindSockets(Daemon::$settings['mod' . $this->modname . 'listen'], Daemon::$settings['mod' . $this->modname . 'listenport']);
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:8,代码来源:TelnetHoneypot.php

示例7: init

 public function init()
 {
     Daemon::addDefaultSettings(array('mod' . $this->modname . 'listen' => 'tcp://0.0.0.0', 'mod' . $this->modname . 'listenport' => 8818, 'mod' . $this->modname . 'passphrase' => 'secret', 'mod' . $this->modname . 'enable' => 0));
     if (Daemon::$settings['mod' . $this->modname . 'enable']) {
         Daemon::log(__CLASS__ . ' up.');
         $this->bindSockets(Daemon::$settings['mod' . $this->modname . 'listen'], Daemon::$settings['mod' . $this->modname . 'listenport']);
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:8,代码来源:DebugConsole.php

示例8: init

 public function init()
 {
     Daemon::$settings += array('mod' . $this->modname . 'listen' => 'tcp://0.0.0.0', 'mod' . $this->modname . 'listenport' => 1080, 'mod' . $this->modname . 'auth' => 0, 'mod' . $this->modname . 'username' => 'User', 'mod' . $this->modname . 'password' => 'Password', 'mod' . $this->modname . 'enable' => 0);
     if (Daemon::$settings['mod' . $this->modname . 'enable']) {
         Daemon::log(__CLASS__ . ' up.');
         $this->bindSockets(Daemon::$settings['mod' . $this->modname . 'listen'], Daemon::$settings['mod' . $this->modname . 'listenport'], TRUE);
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:8,代码来源:SocksServer.php

示例9: init

 public function init()
 {
     Daemon::addDefaultSettings(array('mod' . $this->modname . 'listen' => 'tcp://0.0.0.0', 'mod' . $this->modname . 'listenport' => 843, 'mod' . $this->modname . 'file' => Daemon::$dir . '/conf/crossdomain.xml', 'mod' . $this->modname . 'enable' => 0));
     if (Daemon::$settings['mod' . $this->modname . 'enable']) {
         Daemon::log(__CLASS__ . ' up.');
         $this->bindSockets(Daemon::$settings['mod' . $this->modname . 'listen'], Daemon::$settings['mod' . $this->modname . 'listenport']);
         $this->update();
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:9,代码来源:FlashPolicy.php

示例10: onFrame

 /**
  * Called when new frame received.
  * @param string Frame's contents.
  * @param integer Frame's type.
  * @return void
  */
 public function onFrame($data, $type)
 {
     if ($data === 'ping') {
         $this->client->sendFrame('pong', 'STRING', function ($client) {
             // optional. called when the frame is transmitted to the client
             Daemon::log('ExampleWebSocket: \'pong\' received by client.');
         });
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:15,代码来源:ExampleWebSocket.php

示例11: init

 public static function init()
 {
     if (!(self::$supported = extension_loaded('eio'))) {
         Daemon::log('FS: missing pecl-eio, Filesystem I/O performance compromised. Consider installing pecl-eio.');
         return;
     }
     self::$fdCache = new CappedCacheStorageHits(self::$fdCacheSize);
     eio_init();
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:9,代码来源:FS.php

示例12: addRoute

 /**
  * Adds a route if it doesn't exist already.
  * @param string Route name.
  * @param mixed Route's callback.
  * @return boolean Success.
  */
 public function addRoute($route, $cb)
 {
     if (isset($this->routes[$route])) {
         Daemon::log(__METHOD__ . ' Route \'' . $route . '\' is already defined.');
         return false;
     }
     $this->routes[$route] = $cb;
     return true;
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:15,代码来源:WebSocketServer.php

示例13: proxy

 /**
  * Returns a proxy callback function with logging for debugging purposes
  * @param  callable $cb Callback
  * @param  mixed $name Data
  * @return callable
  */
 public static function proxy($cb, $name = null)
 {
     static $i = 0;
     $n = ++$i;
     Daemon::log('Debug::proxy #' . $n . ': SPAWNED (' . json_encode($name) . ')');
     return function (...$args) use($cb, $name, $n) {
         Daemon::log('Debug::proxy #' . $n . ': CALLED (' . json_encode($name) . ')');
         $cb(...$args);
     };
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:16,代码来源:Debug.php

示例14: init

 public function init()
 {
     Daemon::addDefaultSettings(array('mod' . $this->modname . 'dbname' => 'chat', 'mod' . $this->modname . 'adminpassword' => '', 'mod' . $this->modname . 'enable' => 0));
     if (Daemon::$settings['mod' . $this->modname . 'enable']) {
         Daemon::log(__CLASS__ . ' up.');
         $this->db = Daemon::$appResolver->getInstanceByAppName('MongoClient');
         $this->dbname =& Daemon::$settings[$k = 'mod' . $this->modname . 'dbname'];
         $this->tags = array();
         $this->minMsgInterval = 1;
     }
 }
开发者ID:svcorp77,项目名称:phpdaemon,代码行数:11,代码来源:Chat.php

示例15: init

 /**
  * Constructor.
  * @return void
  */
 public function init()
 {
     if ($this->isEnabled()) {
         list($class, $name) = explode(':', $this->name . ':');
         if (!class_exists($class)) {
             Daemon::log($class . ' class not exists.');
             return;
         }
         $this->pool = call_user_func(array($class, 'getInstance'), $name);
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:15,代码来源:Pool.php


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