public function onMasterStart($server) { file_put_contents($this->pid_file, $server->master_pid); if (APP_DEBUG) { Console::println("Service[{$server->master_pid}] startup success !"); } \Pinst::warning("server was start on {$this->port} !"); }
protected function log($msg, $level = Logger::LEVEL_DEBUG) { if ($level < Logger::LEVEL_WARNING) { \Pinst::debug($msg); } else { \Pinst::error($msg); } }
public function handleFatalError() { $error = error_get_last(); if (empty($error)) { return; } if (in_array($error['type'], array(E_ERROR, E_WARNING))) { \Pinst::error("{$error['message']}\n\tin{$error['file']}({$error['line']})"); } }
/** * get component * @param $name component name * @return mixed return component object * @throws UnknownPropertyException */ protected function getComponent($name) { $component = $this->components[$name]; $this->{$name} = \Pinst::createObject($component); return $this->getProperty($name); }
<?php define("PINST_PATH", __DIR__); require PINST_PATH . '/BasePinst.php'; class Pinst extends \pinst\BasePinst { } if (!defined("APP_DEBUG")) { define("APP_DEBUG", true); } Pinst::addNamespaceMap("pinst", PINST_PATH); spl_autoload_register(['Pinst', 'autoload'], true, true);