Example #1
0
 /**
  * @param $message
  * @return bool
  */
 public function log($message)
 {
     if (null !== ($logger = $this->handler->getLogger())) {
         return $logger->error($message, ['error' => $this->getThrowable()->getMessage(), 'file' => $this->getThrowable()->getFile(), 'line' => $this->getThrowable()->getLine(), 'code' => $this->getStatusCode(), 'get' => $_GET, 'post' => $_POST]);
     }
     return false;
 }
Example #2
0
 /**
  * Initialize application container.
  *
  * @return void
  */
 public function initializeContainer()
 {
     $this->container = new Container(['kernel.database' => Fdb::class, 'kernel.config' => Config::class, 'kernel.storage' => Storage::class, 'kernel.routing' => '\\Routes::getRouter', 'kernel.debug' => Debug::enable($this->isDebug())]);
     $this->container->set('kernel.container', $this->container);
     $this->container->set('kernel.dispatch', new Dispatcher($this->container));
     $this->container->set('kernel', $this);
     $this->registerService($this->container);
     $this->container->singleton('kernel.dispatch')->dispatch('handle.error');
 }
Example #3
0
<?php

/**
 * Created by PhpStorm.
 * User: janhuang
 * Date: 15/8/14
 * Time: 下午2:10
 * Github: https://www.github.com/janhuang
 * Coding: https://www.coding.net/janhuang
 * SegmentFault: http://segmentfault.com/u/janhuang
 * Blog: http://segmentfault.com/blog/janhuang
 * Gmail: bboyjanhuang@gmail.com
 * WebSite: http://www.janhuang.me
 */
include __DIR__ . '/../vendor/autoload.php';
$debug = \FastD\Debug\Debug::enable();
try {
    echo abc();
} catch (Exception $e) {
    echo $e->getMessage();
}
Example #4
0
 /**
  * @param array|null $parameters
  * @return mixed
  */
 public function dispatch(array $parameters = null)
 {
     Debug::enable(false)->setLogger($this->getLogger(self::LOG_ERROR));
 }
Example #5
0
<?php

/**
 * Created by PhpStorm.
 * User: janhuang
 * Date: 15/8/8
 * Time: 下午12:27
 * Github: https://www.github.com/janhuang
 * Coding: https://www.coding.net/janhuang
 * SegmentFault: http://segmentfault.com/u/janhuang
 * Blog: http://segmentfault.com/blog/janhuang
 * Gmail: bboyjanhuang@gmail.com
 * WebSite: http://www.janhuang.me
 */
include __DIR__ . '/../vendor/autoload.php';
$logger = new \Monolog\Logger('test');
$stream = new \Monolog\Handler\StreamHandler(__DIR__ . '/test.log');
$stream->setFormatter(new Monolog\Formatter\LineFormatter("[%datetime%] >> %level_name%: >> %message% >> %context% >> %extra%\n"));
$logger->pushHandler($stream);
$debug = \FastD\Debug\Debug::enable(false, $logger);
throw new ErrorException('test');
Example #6
0
<?php

/**
 * Created by PhpStorm.
 * User: janhuang
 * Date: 16/4/28
 * Time: 下午11:18
 * Github: https://www.github.com/janhuang
 * Coding: https://www.coding.net/janhuang
 * SegmentFault: http://segmentfault.com/u/janhuang
 * Blog: http://segmentfault.com/blog/janhuang
 * Gmail: bboyjanhuang@gmail.com
 * WebSite: http://www.janhuang.me
 */
include __DIR__ . '/../vendor/autoload.php';
use FastD\Debug\Debug;
Debug::enable(false);
echo abc();
Example #7
0
<?php

/**
 * Created by PhpStorm.
 * User: janhuang
 * Date: 16/6/4
 * Time: 上午10:21
 * Github: https://www.github.com/janhuang
 * Coding: https://www.coding.net/janhuang
 * Blog: http://segmentfault.com/blog/janhuang
 */
include __DIR__ . '/../vendor/autoload.php';
use FastD\Debug\Debug;
Debug::enable();
echo $a;
Example #8
0
 public function setUp()
 {
     Debug::enable();
 }
Example #9
0
/**
 * Created by PhpStorm.
 * User: janhuang
 * Date: 15/8/8
 * Time: 下午7:32
 * Github: https://www.github.com/janhuang
 * Coding: https://www.coding.net/janhuang
 * SegmentFault: http://segmentfault.com/u/janhuang
 * Blog: http://segmentfault.com/blog/janhuang
 * Gmail: bboyjanhuang@gmail.com
 * WebSite: http://www.janhuang.me
 */
include __DIR__ . '/../vendor/autoload.php';
use FastD\Debug\Debug;
$debug = Debug::enable(false);
class PageException extends \FastD\Debug\Exceptions\HttpException
{
    /**
     * Returns the status code.
     *
     * @return int An HTTP response status code
     */
    public function getStatusCode()
    {
        return 400;
    }
    /**
     * Returns response headers.
     *
     * @return array Response headers