本文整理汇总了PHP中Ak::getLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::getLogger方法的具体用法?PHP Ak::getLogger怎么用?PHP Ak::getLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::getLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
function _init()
{
$this->logger =& Ak::getLogger();
$base = AK_TEST_DIR . DS . 'unit' . DS . 'lib' . DS;
$this->GroupTest($this->title);
$allFiles = glob($base . $this->baseDir);
if (isset($this->excludes)) {
$excludes = array();
$this->excludes = @Ak::toArray($this->excludes);
foreach ($this->excludes as $pattern) {
$excludes = array_merge($excludes, glob($base . $pattern));
}
$this->excludes = $excludes;
} else {
$this->excludes = array();
}
if (count($allFiles) >= 1 && $allFiles[0] != $base . $this->baseDir && $this->partial_tests === true) {
$this->_includeFiles($allFiles);
} else {
if (is_array($this->partial_tests)) {
foreach ($this->partial_tests as $test) {
//$this->log('Including partial testfile:'.$test);
$this->addTestFile($base . $this->baseDir . DS . $test . '.php');
}
} else {
echo "No files in : " . $this->title . "\n";
}
}
}
示例2: log
public function log($message, $type = '', $identifyer = '')
{
if (AK_LOG_EVENTS) {
$Logger =& Ak::getLogger();
$Logger->log($message, $type);
}
}
示例3: deliver
public function deliver(&$Mailer, $settings = array())
{
$encoded_message = $Mailer->getRawMessage();
$settings['ActionMailer']->deliveries[] = $encoded_message;
if (AK_DEV_MODE) {
$Logger = Ak::getLogger('mail');
$Logger->message($encoded_message);
}
}
示例4: __construct
/**
* @param array $database_settings
*/
function __construct($database_settings, $auto_connect = false)
{
$this->settings = $database_settings;
if ($auto_connect){
$this->connect();
}
if (AK_LOG_EVENTS){
$this->logger =& Ak::getLogger();
}
}
示例5: trim
public function &recognize($Map = null)
{
$this->_startSession();
$this->_enableInternationalizationSupport();
$this->mapRoutes($Map);
$params = $this->getParams();
$module_path = $module_class_peffix = '';
if (!empty($params['module'])) {
$module_path = trim(str_replace(array('/', '\\'), DS, Ak::sanitize_include($params['module'], 'high')), DS) . DS;
$module_shared_model = AkConfig::getDir('controllers') . DS . trim($module_path, DS) . '_controller.php';
$module_class_peffix = str_replace(' ', '_', AkInflector::titleize(str_replace(DS, ' ', trim($module_path, DS)))) . '_';
}
$controller_file_name = AkInflector::underscore($params['controller']) . '_controller.php';
$controller_class_name = $module_class_peffix . AkInflector::camelize($params['controller']) . 'Controller';
$controller_path = AkConfig::getDir('controllers') . DS . $module_path . $controller_file_name;
if (!empty($module_path) && file_exists($module_shared_model)) {
include_once $module_shared_model;
}
if (!is_file($controller_path) || !(include_once $controller_path)) {
AK_LOG_EVENTS && Ak::getLogger()->error('Controller ' . $controller_path . ' not found.');
if (AK_ENVIRONMENT == 'development') {
trigger_error(Ak::t('Could not find the file /app/controllers/<i>%controller_file_name</i> for ' . 'the controller %controller_class_name', array('%controller_file_name' => $controller_file_name, '%controller_class_name' => $controller_class_name)), E_USER_ERROR);
} elseif (@(include AkConfig::getDir('public') . DS . '404.php')) {
$response = new AkTestResponse();
$response->addHeader('Status', 404);
return false;
//exit;
} else {
//header("HTTP/1.1 404 Not Found");
$response = new AkResponse();
$response->addHeader('Status', 404);
return false;
//die('404 Not found');
}
}
if (!class_exists($controller_class_name)) {
AK_LOG_EVENTS && Ak::getLogger()->error('Controller ' . $controller_path . ' does not implement ' . $controller_class_name . ' class.');
if (AK_ENVIRONMENT == 'development') {
trigger_error(Ak::t('Controller <i>%controller_name</i> does not exist', array('%controller_name' => $controller_class_name)), E_USER_ERROR);
} elseif (@(include AkConfig::getDir('public') . DS . '405.php')) {
exit;
} else {
$response = new AkResponse();
$response->addHeader('Status', 405);
return false;
//header("HTTP/1.1 405 Method Not Allowed");
//die('405 Method Not Allowed');
}
}
$Controller = new $controller_class_name(array('controller' => true));
$Controller->setModulePath($module_path);
isset($_SESSION) ? $Controller->session =& $_SESSION : null;
return $Controller;
}
示例6: deliver
public function deliver(&$Mailer, $settings = array())
{
$encoded_message = $Mailer->getRawMessage();
$settings['ActionMailer']->deliveries[] = $encoded_message;
if (!AK_PRODUCTION_MODE) {
$Logger = Ak::getLogger('mail');
$Logger->message($encoded_message);
}
if (AK_TEST_MODE) {
Ak::setStaticVar('last_mail_delivered', $encoded_message);
}
}
示例7: logError
public function logError($Exception)
{
if (!($Logger = Ak::getLogger())) {
return;
}
$message = $Exception->getMessage() . "\n" . $Exception->getTraceAsString();
$original_faltal_setting = AkConfig::getOption('logger.exit_on_fatal', true);
$original_display_setting = AkConfig::getOption('logger.display_message', true);
$original_mail_setting = AkConfig::getOption('logger.send_mails', true);
AkConfig::setOption('logger.exit_on_fatal', false);
AkConfig::setOption('logger.display_message', false);
AkConfig::setOption('logger.send_mails', false);
$Logger->fatal("\n" . get_class($Exception) . (empty($message) ? '' : ': (' . $message . ")") . "\n ");
AkConfig::setOption('logger.exit_on_fatal', $original_faltal_setting);
AkConfig::setOption('logger.display_message', $original_display_setting);
AkConfig::setOption('logger.send_mails', $original_mail_setting);
}
示例8: _raiseError
function _raiseError($error)
{
if (AK_LOG_EVENTS) {
empty($this->_Logger) && ($this->_Logger =& Ak::getLogger());
$this->_Logger->error($error);
}
if (AK_ENVIRONMENT == 'development') {
header('HTTP/1.1 404 Not Found');
trigger_error($error, E_USER_ERROR);
} elseif (@(include AK_PUBLIC_DIR . DS . '404.php')) {
exit;
} else {
header('HTTP/1.1 404 Not Found');
die('404 Not Found');
}
}
示例9: runTaskFiles
public function runTaskFiles($task_name, $options = array())
{
$files = $this->_getTaskFiles($task_name);
$task_name = str_replace(':', DS, $task_name);
$Makelos = $this;
$Logger = Ak::getLogger('makelos' . DS . AkInflector::underscore($task_name));
foreach ($files as $file) {
$pathinfo = pathinfo($file);
if (isset($pathinfo['extension']) && $pathinfo['extension'] == 'php') {
include $file;
} else {
echo `{$file}`;
}
}
}
示例10: _log
protected function _log($message, $parameters = array(), $type = 'info')
{
if (AK_LOG_EVENTS) {
if (empty($this->_Logger)) {
$this->_Logger = Ak::getLogger();
}
$this->_Logger->{$type}($message, $parameters);
}
}
示例11: empty
function &AkResponse()
{
$null = null;
$AkResponse =& Ak::singleton('AkResponse', $null);
AK_LOG_EVENTS && empty($AkResponse->_Logger) ? $AkResponse->_Logger =& Ak::getLogger() : null;
return $AkResponse;
}
示例12: process
function process(&$Request, &$Response)
{
AK_LOG_EVENTS && empty($this->_Logger) ? $this->_Logger =& Ak::getLogger() : null;
$this->Request =& $Request;
$this->Response =& $Response;
$this->params = $this->Request->getParams();
$this->_action_name = $this->Request->getAction();
$this->_ensureActionExists();
Ak::t('Akelos');
// We need to get locales ready
if ($this->_high_load_mode !== true) {
if (!empty($this->_auto_instantiate_models)) {
$this->instantiateIncludedModelClasses();
}
if (!empty($this->_enable_plugins)) {
$this->loadPlugins();
}
if (!empty($this->helpers)) {
$this->instantiateHelpers();
}
} else {
$this->_enableLayoutOnRender = false;
}
$this->_ensureProperProtocol();
// After filters
$this->afterFilter('_handleFlashAttribute');
$this->_loadActionView();
if (isset($this->api)) {
require_once AK_LIB_DIR . DS . 'AkActionWebService.php';
$this->aroundFilter(new AkActionWebService($this));
}
$this->performActionWithFilters($this->_action_name);
if (!$this->_hasPerformed()) {
$this->_enableLayoutOnRender ? $this->renderWithLayout() : $this->renderWithoutLayout();
}
if (!empty($this->validate_output)) {
$this->_validateGeneratedXhtml();
}
$this->Response->outputResults();
}
示例13: log
function log($message)
{
if (AK_LOG_EVENTS){
static $logger;
if(empty($logger)) {
$logger = &Ak::getLogger();
}
$logger->log('unit-test',$message);
}
}
示例14: init
function init($attributes = array())
{
AK_LOG_EVENTS ? ($this->Logger =& Ak::getLogger()) : null;
$this->_internationalize = is_null($this->_internationalize) && AK_ACTIVE_RECORD_INTERNATIONALIZE_MODELS_BY_DEFAULT ? count($this->getAvailableLocales()) > 1 : $this->_internationalize;
@$this->_instantiateDefaultObserver();
$this->establishConnection();
if(!empty($this->table_name)){
$this->setTableName($this->table_name);
}
$load_acts = isset($attributes[1]['load_acts']) ? $attributes[1]['load_acts'] : (isset($attributes[0]['load_acts']) ? $attributes[0]['load_acts'] : true);
$this->act_as = !empty($this->acts_as) ? $this->acts_as : (empty($this->act_as) ? false : $this->act_as);
if (!empty($this->act_as) && $load_acts) {
$this->_loadActAsBehaviours();
}
if(!empty($this->combined_attributes)){
foreach ($this->combined_attributes as $combined_attribute){
$this->addCombinedAttributeConfiguration($combined_attribute);
}
}
if(isset($attributes[0]) && is_array($attributes[0]) && count($attributes) === 1){
$attributes = $attributes[0];
$this->_newRecord = true;
}
// new AkActiveRecord(23); //Returns object with primary key 23
if(isset($attributes[0]) && count($attributes) === 1 && $attributes[0] > 0){
$record = $this->find($attributes[0]);
if(!$record){
return false;
}else {
$this->setAttributes($record->getAttributes(), true);
}
// This option is only used internally for loading found objects
}elseif(isset($attributes[0]) && isset($attributes[1]) && $attributes[0] == 'attributes' && is_array($attributes[1])){
foreach(array_keys($attributes[1]) as $k){
$attributes[1][$k] = $this->castAttributeFromDatabase($k, $attributes[1][$k]);
}
$avoid_loading_associations = isset($attributes[1]['load_associations']) ? false : !empty($this->disableAutomatedAssociationLoading);
$this->setAttributes($attributes[1], true);
}else{
$this->newRecord($attributes);
}
if($this->_dynamicMethods){
$this->_buildFinders();
}
empty($avoid_loading_associations) ? $this->loadAssociations() : null;
}
示例15: reportError
public function reportError($options = array())
{
if (AK_LOG_EVENTS && !empty($options['log'])) {
Ak::getLogger()->error($options['log']);
}
if (AK_DEV_MODE && !empty($options['message'])) {
trigger_error($options['message'], E_USER_ERROR);
} else {
$status_code = intval(empty($options['status_code']) ? 501 : $options['status_code']);
$status_header = AkResponse::getStatusHeader($status_code);
if (!@(include AkConfig::getDir('public') . DS . $status_code . '.php')) {
@Ak::header($status_header);
echo str_replace('HTTP/1.1 ', '', $status_header);
}
}
exit(0);
}