本文整理汇总了PHP中Logger::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::initialize方法的具体用法?PHP Logger::initialize怎么用?PHP Logger::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::initialize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConfigureWithEmptyIniFile
public function testConfigureWithEmptyIniFile()
{
$catchedException = null;
try {
Logger::configure('configurators/test2.properties');
Logger::initialize();
self::assertTrue(false);
} catch (LoggerException $e) {
$catchedException = $e;
}
self::assertNotNull($catchedException);
}
示例2: testUsage
public function testUsage()
{
Logger::resetConfiguration();
Logger::configure(dirname(__FILE__) . '/test4.properties');
Logger::initialize();
$logger = Logger::getRootLogger();
ob_start();
$logger->error(new Fruit3());
$v = ob_get_contents();
ob_end_clean();
self::assertEquals("ERROR - test1,test2,test3\n", $v);
}
示例3: initialize
/**
* Initializes this logger.
*
* @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
* @param array $options An array of options.
*/
public function initialize($options = array())
{
parent::initialize($options);
if (!isset($options['file_name'])) {
throw new StartupInitParamsExceptionException(get_class($this), 'file_name');
}
// if (!isset($options['u_file_name']))
// {
// throw new StartupInitParamsExceptionException(get_class($this), 'u_file_name');
// }
if (!isset($options['format'])) {
throw new StartupInitParamsExceptionException(get_class($this), 'format');
}
if (!isset($options['inner_format'])) {
throw new StartupInitParamsExceptionException(get_class($this), 'inner_format');
}
$this->format = $options['format'];
$this->inner_format = $options['inner_format'];
$this->file_name = ConfigManager::bind()->getBaseDir() . '/log/' . $options['file_name'];
$this->u_file_name = ConfigManager::bind()->getBaseDir() . '/log/' . $options['u_file_name'];
$this->event_dispatcher->connect('application.log_exception', array($this, 'ApplicationLogExceptionEventHandler'));
}
示例4: testRenderer
public function testRenderer()
{
Logger::configure('configurators/test4.properties');
Logger::initialize();
$hierarchy = Logger::getHierarchy();
$map = $hierarchy->getRendererMap();
$clazz = $map->getByClassName('Fruit');
self::assertTrue($clazz instanceof FruitRenderer);
}
示例5: testGetCurrentLoggers
public function testGetCurrentLoggers()
{
Logger::clear();
Logger::resetConfiguration();
self::assertEquals(0, count(Logger::getCurrentLoggers()));
Logger::configure('LoggerTest.properties');
Logger::initialize();
self::assertEquals(1, count(Logger::getCurrentLoggers()));
$list = Logger::getCurrentLoggers();
self::assertEquals('mylogger', $list[0]->getName());
}
示例6: initialize
/**
* Initializes this logger.
*
* @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
* @param array $options An array of options.
*/
public function initialize($options = array())
{
parent::initialize($options);
$this->event_dispatcher->connect('webbot.log', array($this, 'ConsoleLogEventHandler'));
}
示例7: date_default_timezone_set
$define('APP_FAILED_LOGIN_BACKOFF_MINUTES', 15);
$define('APP_HIDE_CLOSED_STATS_COOKIE', 'eventum_hide_closed_stats');
// if set, normal calls to eventum are redirected to a maintenance page while
// requests to /manage/ still work
$define('APP_MAINTENANCE', false);
require_once APP_PATH . '/autoload.php';
// fix magic_quote_gpc'ed values
if (get_magic_quotes_gpc()) {
$_GET = Misc::dispelMagicQuotes($_GET);
$_POST = Misc::dispelMagicQuotes($_POST);
$_REQUEST = Misc::dispelMagicQuotes($_REQUEST);
}
Misc::stripInput($_POST);
// set default timezone
date_default_timezone_set(APP_DEFAULT_TIMEZONE);
Logger::initialize();
Language::setup();
// set charset
header('Content-Type: text/html; charset=' . APP_CHARSET);
// display maintenance message if requested.
if (APP_MAINTENANCE) {
$is_manage = strpos($_SERVER['PHP_SELF'], '/manage/') !== false;
if (APP_MAINTENANCE && !$is_manage) {
$tpl = new Template_Helper();
$tpl->setTemplate("maintenance.tpl.html");
$tpl->displayTemplate();
exit(0);
}
}
// Default IRC category
$define("APP_EVENTUM_IRC_CATEGORY_DEFAULT", "default");
示例8: initialize
/**
* Initializes this logger.
*
* @param sfEventDispatcher $dispatcher A sfEventDispatcher instance
* @param array $options An array of options.
*/
public function initialize($options = array())
{
parent::initialize($options);
$this->event_dispatcher->connect('webbot.log', array($this, 'WebbotLogEventHandler'));
$this->event_dispatcher->connect('context.webbot_injected', array($this, 'ContextWebbotInjectedEventHandler'));
}