本文整理汇总了PHP中Logger::trace方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::trace方法的具体用法?PHP Logger::trace怎么用?PHP Logger::trace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::trace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param array $conf Configurations for reaching Gerrit server
*/
public function __construct()
{
/** @var \Bart\Configuration\GerritConfig $config */
$config = Diesel::create('Bart\\Configuration\\GerritConfig');
/** @var \Bart\SshWrapper $ssh */
$ssh = Diesel::create('Bart\\SshWrapper', $config->host(), $config->sshPort());
$ssh->setCredentials($config->sshUser(), $config->sshKeyFile());
$this->ssh = $ssh;
$this->config = $config;
$this->logger = Log4PHP::getLogger(__CLASS__);
$this->logger->trace("Configured Gerrit API using ssh {$ssh}");
}
示例2: post_upload_action
/**
* 上传图片
* @throws Exception
*/
function post_upload_action()
{
$redirect = false;
if (empty($_FILES['image']['tmp_name'])) {
if (!isset($_POST['image'])) {
throw new Exception('hapn.u_notfound');
}
$content = $_POST['image'];
} else {
$content = file_get_contents($_FILES['image']['tmp_name']);
$redirect = true;
}
if (!getimagesizefromstring($content)) {
throw new Exception('image.u_fileIllegal');
}
$start = microtime(true);
$imgApi = new StorageExport();
$info = $imgApi->save($content);
ksort($info);
Logger::trace(sprintf('upload cost:%.3fms', (microtime(true) - $start) * 1000));
if ($redirect) {
$this->response->redirect('/image/upload?img=' . $info['img_id'] . '.' . $info['img_ext']);
} else {
$this->request->of = 'json';
$this->response->setRaw(json_encode($info));
}
}
示例3: on_rpc
/**
* Запуск периодических задач.
*
* Проверяется время последнего запуска, чаще установленного администратором
* времени запуск производиться не будет (по умолчанию 15 минут).
*/
public static function on_rpc(Context $ctx)
{
$status = "DELAYED";
$lastrun = $ctx->config->get('modules/cron/lastrun');
$delay = $ctx->config->get('modules/cron/delay', 15) * 60;
if (time() >= $lastrun + $delay) {
$ctx->config->set('modules/cron/lastrun', time());
$ctx->config->save();
@set_time_limit(0);
ob_start();
try {
$ctx->registry->broadcast('ru.molinos.cms.cron', array($ctx));
$status = "OK";
} catch (Exception $e) {
Logger::trace($e);
$status = "ERROR: " . get_class($e) . '; ' . trim($e->getMessage(), '.') . '.';
}
ob_end_clean();
}
if ($ctx->get('destination')) {
return $ctx->getRedirect();
}
if (!MCMS_CONSOLE) {
header('Content-Type: text/plain; charset=utf-8');
die($status);
}
die;
}
示例4: login
public function login()
{
vendor("Logger.Logger", LIB_PATH . '../Extend/Vendor');
$logger = new Logger();
$logger->trace('The stacktrace is ');
$domain = $_SERVER['SERVER_NAME'];
if (preg_match("/^([A-Za-z0-9]+)\\.weixin\\.[A-Za-z0-9]+\\.com\$/i", $domain, $matches)) {
//是oem客户
$oem_name = $matches[1];
if (!empty($oem_name)) {
$login_pic = session('oem_logo');
if (empty($login_pic)) {
$sql = "select ac.cfg_data, u.role from tp_user as u LEFT JOIN tp_oem_cfg as ac on u.id = ac.agent_id where u.domain_prefix = '{$oem_name}'; ";
$Model = new Model();
$user = $Model->query($sql);
if ($user != false) {
$this->agent_cfg = $this->getAgentCfg($user[0]['cfg_data']);
$login_pic = $this->agent_cfg['company_logo'];
if (!empty($login_pic)) {
session('oem_logo', $login_pic);
}
}
}
}
$this->assign('is_oem', 1);
} else {
//不是oem用户
$login_pic = '/images/login_logo.png';
}
$this->assign('login_pic', $login_pic);
$this->display();
}
示例5: trace
/**
* @param string|\Exception $msg
* @param array $context
* @throws \RuntimeException
*/
public static function trace($msg, array $context = array())
{
if (empty(static::$instance)) {
throw new \RuntimeException('Logger instance not added to proxy yet');
}
static::$instance->trace($msg, $context);
}
示例6: run
/**
* @param bool $returnOutputAsString [Optional] By default, command output is returned as an array
* @return array|string Output of command
* @throws CommandException if command fails
*/
public function run($returnOutputAsString = false)
{
$output = array();
$returnVar = 0;
$this->logger->trace('Executing ' . $this->safeCommandStr);
exec($this->safeCommandStr, $output, $returnVar);
if ($returnVar !== 0) {
$this->logger->error('Non-zero exit status ' . $returnVar);
throw new CommandException("Got bad status {$returnVar} for {$this->safeCommandStr}. Output: " . implode("\n", $output));
}
return $returnOutputAsString ? implode("\n", $output) : $output;
}
示例7: testLogLevel
public function testLogLevel()
{
$rootAppender = new LoggerAppenderTest();
$root = new Logger('root');
$root->addAppender($rootAppender);
$logger = new Logger('logger', $root);
$logger->trace('trace');
$logger->debug('debug');
$logger->info('info');
$logger->warn('warn');
$logger->error('error');
$logger->fatal('fatal');
$this->assertEquals(array(array(Logger::TRACE, 'trace'), array(Logger::DEBUG, 'debug'), array(Logger::INFO, 'info'), array(Logger::WARN, 'warn'), array(Logger::ERROR, 'error'), array(Logger::FATAL, 'fatal')), $rootAppender->logs);
}
示例8: handle
public function handle($headers, $body, $outputClass = null)
{
if ($outputClass !== null) {
$this->getUnmarshaller()->setOutputClass($outputClass);
}
Logger::info('Handling callback');
Logger::trace('Headers: {0}', $headers);
Logger::trace('Body: {0}', $body);
if (!$this->isSignatureCheckDisabled()) {
$securityHelper = new SecurityHelper($this->apiKey, $this->signatureKey, $this->partnerApiKey, $this->partnerSignatureKey);
$signature = $securityHelper->getSignature($headers);
//var_dump($headers);
$securityHelper->checkSignature($signature, $body);
}
return $this->getUnmarshaller()->unmarshall($body);
}
示例9: serve
/**
* Вывод административной страницы. Вызывает обработчик, указанный в next,
* предварительно проверив права пользователя.
*/
public static function serve(Context $ctx, $path, array $pathinfo)
{
if (class_exists('APIStream')) {
APIStream::init($ctx);
}
try {
self::checkperm($ctx, $pathinfo);
if (!$ctx->user->id and empty($pathinfo['anonymous'])) {
throw new UnauthorizedException();
}
if (empty($pathinfo['next'])) {
if (!empty($pathinfo['xsl'])) {
$pathinfo['next'] = 'AdminPage::xsltonly';
} else {
throw new RuntimeException(t('Не указан обработчик для страницы %path (параметр <tt>next</tt>).', array('%path' => $path)));
}
}
if (!is_callable($pathinfo['next'])) {
throw new RuntimeException(t('Неверный обработчик для страницы %path (<tt>%next()</tt>).', array('%path' => $path, '%next' => $pathinfo['next'])));
}
$args = func_get_args();
$output = call_user_func_array($pathinfo['next'], $args);
if (!$output instanceof Response) {
$xsl = empty($pathinfo['xsl']) ? null : implode(DIRECTORY_SEPARATOR, explode('/', $pathinfo['xsl']));
$tmp = new AdminPage($output, $xsl);
$output = $tmp->getResponse($ctx);
}
return $output;
} catch (NotConnectedException $e) {
Logger::trace($e);
if (is_dir(os::path('lib', 'modules', 'install'))) {
$ctx->redirect('install?destination=' . urlencode(MCMS_REQUEST_URI));
} else {
throw new RuntimeException('Система не проинсталлирована и модуля install нет.');
}
} catch (Exception $e) {
Logger::trace($e);
$data = array('status' => 500, 'error' => get_class($e), 'message' => $e->getMessage(), 'version' => MCMS_VERSION, 'release' => MCMS_RELEASE, 'base' => $ctx->url()->getBase($ctx), 'prefix' => MCMS_SITE_FOLDER . '/themes', 'back' => urlencode(MCMS_REQUEST_URI), 'next' => urlencode($ctx->get('destination')), 'clean' => !empty($_GET['__cleanurls']));
if ($e instanceof UserErrorException) {
$data['status'] = $e->getCode();
}
$xsl = os::path('lib', 'modules', 'admin', 'template.xsl');
xslt::transform(html::em('page', $data), $xsl)->send();
}
}
示例10: _createCustomerEntry
private function _createCustomerEntry(RecordCustomer $rec)
{
$nameFirst = $rec->nameFirst;
$nameLast = $rec->nameLast;
$email = $rec->email;
/* save customer and update customer group */
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer');
$customer->setFirstname($nameFirst);
$customer->setLastname($nameLast);
$customer->setEmail($email);
$customer->setWebsiteId(1);
try {
$customer->save();
$this->_log->trace("New customer '{$nameFirst} {$nameLast} <{$email}>' is saved.");
} catch (Exception $e) {
$this->_log->error("Cannot save customer '{$nameFirst} {$nameLast} <{$email}>'.", $e);
}
}
示例11: on_format_text
/**
* Дополнительная обработка текстовых полей.
*
* @param Context $ctx
* @param string $fieldName
* @param string $text
* @static
* @access public
* @return string
* @mcms_message ru.molinos.cms.format.text
*/
public static function on_format_text(Context $ctx, $fieldName, &$text)
{
$fields = $ctx->config->get('modules/pridetypograph/fields', array());
/*
if (!in_array($fieldName, $fields))
return;
*/
if (strlen(trim($text))) {
try {
$typo = self::getTypo();
if (mb_check_encoding($text2 = $typo->parse($text), 'utf-8')) {
$text = $text2;
} else {
Logger::log('Waring: PrideTypograph failed to process this text: ' . $text);
}
} catch (Exception $e) {
Logger::trace($e);
}
}
}
示例12: send
public static function send($from, $to, $subject, $body, array $attachments = null, array $headers = null)
{
if (empty($to)) {
Logger::trace("mail not sent: no recipients: {$subject}");
return;
}
$config = Context::last()->config;
if (empty($from)) {
if (!($from = $config->get('modules/mail/from'))) {
$from = "Molinos.CMS <no-reply@" . MCMS_HOST_NAME . ">";
}
}
if (strstr($body, '<html>') === false) {
$body = '<html><head><title>' . html::plain($subject) . '</title></head><body>' . $body . '</body></html>';
}
if (!is_array($to)) {
$to = preg_split('/, */', $to, -1, PREG_SPLIT_NO_EMPTY);
}
Logger::log(sprintf('to=%s, subject=%s', join(',', $to), $subject), 'mail');
$mail = new htmlMimeMail();
if ('smtp' == ($transport = ($server = $config->get('modules/mail/server')) ? 'smtp' : 'mail')) {
$mail->setSMTPParams($server);
}
$mail->setFrom($from);
$mail->setSubject($subject);
$mail->setHtml(self::fixhtml($body));
$mail->setTextCharset('UTF-8');
$mail->setTextEncoding('base64');
$mail->setHTMLCharset('UTF-8');
$mail->setHTMLEncoding('UTF-8');
$mail->setHeadCharset('UTF-8');
foreach ((array) $attachments as $file) {
$mail->addAttachment($file['data'], $file['name'], $file['type']);
}
foreach ((array) $headers as $k => $v) {
if (!empty($v)) {
$mail->setHeader($k, $v);
}
}
return $mail->send($to, $transport);
}
示例13: route
function route()
{
foreach (include_paths() as $path) {
$base = $path['base'];
$action = $path['action'];
$controller = load_controller($base, $action);
if ($controller) {
if (strpos($base, '/index') === strlen($base) - 6) {
$base = substr($base, 0, strlen($base) - 6);
}
$controller->module = $base == 'index' ? '' : $base;
break;
}
}
if (!$controller) {
$path = base_path();
Logger::trace("No route for {$path}!");
throw new App404Exception("Not found!", 404);
}
return array($base, $controller, $action);
}
示例14: run
public function run()
{
//初始化pipe
$default_pipe = array('TaskProcessPipe' => 'default');
$pipes = Conf::get('global.pipes', array());
if (empty($pipes)) {
$pipes = $default_pipe;
}
$this->pipeLoadContainer = $pipes;
//后台脚本方便日志记录,把所有输出全部定位到日志目录
ob_start();
echo "\n---------------------" . date("Y-m-d H:i:s") . "--------------------\n";
echo "\nrun result:\n";
$this->timer->begin('task_run');
parent::run();
$this->timer->end('task_run');
$time = $this->timer->getResult();
echo "\nrun time : " . $time[0]['1'] / 1000 . " s \n";
echo "\n---------------------" . date("Y-m-d H:i:s") . "--------------------\n";
$res = ob_get_clean();
Logger::trace("%s", var_export($res, true));
}
示例15: log
private static function log($type, $msg, $errorNo, $params)
{
if (class_exists('Xiaoju\\Beatles\\Utils\\Logger')) {
switch ($type) {
case 'debug':
Logger::debug($msg, $errorNo, $params);
break;
case 'trace':
Logger::trace($msg, $errorNo, $params);
break;
case 'notice':
Logger::notice($msg, $errorNo, $params);
break;
case 'warning':
Logger::warning($msg, $errorNo, $params);
break;
case 'fatal':
Logger::fatal($msg, $errorNo, $params);
break;
}
}
}